Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can Sonar be configured to import new rulesets?

Tags:

sonarqube

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?

like image 483
adrianos Avatar asked Apr 11 '11 09:04

adrianos


People also ask

How can I download sonar rules in SonarQube?

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.

Where are SonarQube rules defined?

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.


1 Answers

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.

like image 67
oers Avatar answered Oct 15 '22 17:10

oers