2
votes

I've defined a quality profile containing rules from the sonar analyzer, PMD and Findbugs. However if I want to check those rules in the IDE (IntelliJ IDEA and Eclipse) only the sonar rules are applied (by design). I'd prefer sonarqube server to be the single source of truth and thererfore want to use PMD and Findbugs rules defined on the sonarqube server in my IDE. As far as I know it is not possible to export an PMD or Findbugs config file from sonarqube server.

What is the best way, to use sonarqube server as the single source of truth regarding static coded analysis and using PMD and Findbugs rules defined on the sonarqube server inside an IDE?

2

2 Answers

2
votes

Sonar lint is a plugin for live code analysis. Sonar lint can automatically connect to the configured remote server and fetch quality profiles required to analyse the code. This plugin scans the source code for only rules from SonarAnalyzer repository(As you said).

I suggest you to use the below IntelliJ plugins:

As far as I know it is not possible to export an PMD or Findbugs config file from sonarqube server-this not true

It is possible to export PMD or Findbugs config file but separately

Create a quality profile and activate all the rules of pmd and findbugs in that quality profile.

After that if you click on the created qualityprofile like the one named "pmd" i created in the below screenshotenter image description here

i have only activated pmd rules in it so you can a filter named PMD on the left bottom side.

click on that filter then rules that only belongs to pmd shows up as in the below screenshot.

enter image description here

click ctrl-s and save it into an notepad.this is how you export the rules and findbugs have also been present on the left bottom if i have activated it.

you can use this file to configure the above suggested jetbrains plugins install the plugins and you can configure them in the settings using the exported rule file.

I did this in android-studio.

0
votes

One option is SonarQube Community Plugin

This plugin will display the issues from your Sonar instance in your IDE. It is a nice way to display results of previous scans.

enter image description here