This an an archived version of the documentation for SonarQube version 4.3 and below.
See https://docs.sonarqube.org/display/SONAR/Documentation for current functionality
Finding and Activating / Deactivating Rules
Go to the profile's Coding rules tab. Because some languages have hundreds of coding rules available, the list of rules is headed with a search interface. The default search is always the active rules in the current profile:
The list of rules returned by the search engine is paginated, with 25 rules per page.
Coding rules can be activated or deactivated by, and their severity can be modified. Some rules have parameters which can also be modified:
Bulk change actions allow you to quickly activate or deactivate multiple rules:
No extra validation action is required to make changes to the quality profile.
Since version 3.6, to help you choose which coding rules to activate, each rule has a status:
- Beta: The coding rule has been recently implemented and we haven't gotten enough feedback from users yet, so there may be false positives or false negatives.
- Deprecated: The coding rule should no longer be used because a similar, but more powerful and accurate rule exists.
- Ready: The rule is ready to be used in production.
Rule Creation Date
Since version 3.6 each rule has a creation date to help you spot the new coding rules:
Multiple Activations of a Rule
Some coding rules, such as the XPath rule can be activated multiple times in the same quality profile with different parameter values.
If a rule can be activated multiple times, a Copy rule link is available:
Clicking on the Copy rule link displays a rule-specific form so you can define the new rule:
Once the new rule has been created, it can be managed like any other rule. Note that you will need to explicitly add your new rule to a profile; it will not automatically be added to the profile you created it from.
Extending Rule Description
- You can extend the description of a rule to give more details, add an internal description, etc. :
Extended rule descriptions are useful to let users know why a rule has been included in a profile (if there might be a question) or how your organization is using a particular rule. Your extension will be available to users as a normal part of the rule details:
Your extension will be added to the rule in every quality profile, not just the profile from which you edited the rule, and it will persist with the rule even if the rule is removed from every profile.
Since SonarQube 4.2, it is possible to add tags to coding rules to classify them:
You can then filter rules by tags.