With maven-pmd-plugin, I am able to configure it to scan my unit tests for PMD violations:
<configuration>
<rulesets>
<ruleset>/rulesets/junit.xml</ruleset>
</rulesets>
Sonar 2.0.1 doesn't seem to provide any way to add in new rulesets that I can see. Has anyone figured out how to do this?
Just look at the BUILT-IN Sonar way profiles. These are the default rule sets. Now you just need to create your new profile. we'll call it “Unified”, and copy the Sonar way rules into it.
By default, when entering the top menu item "Rules", you will see all the available rules installed on your SonarQube instance. You have the ability to narrow the selection based on search criteria in the left pane: Language: the language to which a rule applies.
The rules are defined in the sonar server as a set of configurations for pmd, findbugs, checkstyle etc.
You have to reference a configuration in your pom file (see the sonar documentation/wiki).
the property is sonar.profile
But basically you will assign the profile for the project in the sonar server configuration. (see Profiles Section in the Wiki). Profiles will also allow you to move rule configurations between environments, e.g. between development and production.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With