M. Twarog
M. Twarog

Reputation: 2623

How to export all rules from SonarQube Quality Profile to SpotBugs, Checkstyle and PMD rule files

Issue

I am using SonarQube 7.9.1. I have Quality Profile containing ~450 active rules for Java code. There are exporters for FindBugs, PMD and Checkstyle in SonarQube, but they are not exporting all available rules. After export ~20 rules are missing. What can be the cause of that?

Example of missing rule: "Unnecessary imports should be removed". It seems strange, because both Checkstyle and PMD have such rule available.

Question

Is it possible to export all rules defined in SonarQube Quality Profile to Checkstyle, PMD and SpotBugs rule files?

Upvotes: 3

Views: 1044

Answers (1)

agabrys
agabrys

Reputation: 9126

I'm guessing, that you enabled SonarQube rule RSPEC-1128 Unnecessary imports should be removed and now you want to have enabled UnusedImportsCheck in Checkstyle ruleset file. I don't think the exporter works in this way. It just takes all enabled rules of a specified tool and export them in a file. It means that if you enable UnusedImportsCheck Checktyle rule, I'm sure it will be in the exported file.

Is it possible to export all rules defined in SonarQube Quality Profile to Checkstyle, PMD and SpotBugs rule files?

It is possible to export:

  • Checkstyle rules to Checktyle ruleset file
  • PMD rules to PMD ruleset file
  • etc

It is impossible to export SonarQube rules as different tool rules, example:

  • SQUID rules to Checktyle ruleset file

Upvotes: 2

Related Questions