Extend Coding Rules - Via extensions/rules
From version 0.2, its possible to extend the rules available in quality profiles for any tool. To do this a directory matching the tool name and a XML with the description of the rules within this directory should be provided. For example:
- [Sonar Server Install Dir]\extensions\rules\cppcheck\rules.xml for the cppcheck sensor
Rules XML Format
| Xml Description | Example |
|---|---|
<rules> | <?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
| Attributes | Description |
| key [RULE_ID] | Id of the rule, should match the id in the external reports |
| name | Can be really anything, in the quality profile in sonar its the first name that is displayed per rule |
| configKey | This key is used later by the sensor to configure the code analyzer (Extending+Coding+Rules ) |
| category name | Can be anything, examples include Maintainability Style Usability etc |
| description | In the quality profile in sonar ui, the description will be show after expanding each rule |
| Important Once rules have been added to extensions/rules, they should be enabled in the relevant quality profile in Sonar. Only after this has been done, the analysis can be performed |

