| Info |
|---|
|
| The cxx plugin does not run any static analysis tools, thus all reports must be generated externally |
Here is a quick guide how to generate the reports using external tools
Make sure to pass all include directories as otherwise the analysis will be incomplete. Caveat: cppcheck writes the output to the standard error.
| Code Block |
|---|
|
cppcheck -v --enable=all --xml -I<include directory> <sources> 2> report.xml |
| Info |
|---|
|
Extension of cppcheck rules is possible by using [sonar instal dir]/extensions/rules/cppcheck. See Extending Rules in C++ Analysers on how to create the rules |
Just tell valgrind to generate XML output. The 'tool' option isn't necessary as 'memcheck' is the default one. Make sure the binaries contain debug info.
| Code Block |
|---|
valgrind --xml=yes --xml-file=report.xml <program> <arguments>
|
| Info |
|---|
|
Extension of valgrind rules is possible by using [sonar instal dir]/extensions/rules/valgrind. See Extending Rules in C++ Analysers on how to create the rules |
The generation of vera++ reports is somewhat more tricky. We find all the files we want to be analysed, pipe this list into vera++ and pipe its output into a Perl script which finally generates the required XML.
| Code Block |
|---|
find <path> -regex ".*\.cc\|.*\.hh" | vera++ - -showrules -nodup |& vera++Report2checkstyleReport.perl > report.xml |
| Code Block |
|---|
rats -w 3 --xml <sources> > report.xml |
Please refer to product page (Official Site)
| Info |
|---|
Rules for this tool are disabled by default, so they need to be enabled in the relevant quality profile before they can be imported into sonar |