Creation of a profile for
...
a external tool - Mandatory before running a analysis
The creation of a rule set for the external tool re-uses the concept of Extending Rules in C++ Analysers therefore the only thing needed is a xml file with the definition of the rules and their respective activation in sonar. The location of the rules definitions xml file needs to be installed under
...
The property sonar.cxx.externalrules.reportPath needs to be is used to point to the location of the report (relative to project root). The following table describes the format of the report
| Xml Description - RNG-Schema | Example |
|---|---|
<element name="results" xmlns="http://relaxng.org/ns/structure/1.0"> <zeroOrMore> <element name="error"> <attribute name="file"/> <attribute name="msg"/> <attribute name="id"/> <attribute name="line"> <data type="integer" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" /> </attribute> <text/> </element> </zeroOrMore> </element> | <?xml version="1.0"?> |
| Attribute | Description |
| file | source file, relative to project path |
| line | line of the violation |
| id | id of the rule, mapped a rule in sonar. See "Enable the rules in Sonar server" below |
| msg | description of the violation |
List of third party tools and their
...
profiles
| Tool | Source | Usage | Rules Profile / Needed scripts |
|---|---|---|---|
| cpplint | Create the rules profile and the modified cpplint python script as follow:
This will generate the following files:
After this you can run the cpplint_mod.py against any source file like this:
The output file report.txt needs to be converted to xml format described above. For convenience a perl script is available here and can be run as follow:
|
...

