Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
titleCritical
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

cppcheck

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
languagebash
cppcheck -v --enable=all --xml -I<include directory> <sources> 2> report.xml
Info
titleRule Extensions

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 

Valgrind

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
titleRule Extensions

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 

Vera++

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
Info
titleRule Extensions

Extension of vera++ rules is possible by using [sonar instal dir]/extensions/rules/vera++. See Extending Rules in C++ Analysers on how to create the rules

RATS

 

Code Block
rats -w 3 --xml <sources> > report.xml
Info
titleRule Extensions

Extension of rats rules is possible by using [sonar instal dir]/extensions/rules/rats. See Extending Rules in C++ Analysers on how to create the rules


Pc-Lint

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

Info
titleRule Extensions

Extension of pclint rules is possible by using [sonar instal dir]/extensions/rules/pclint. See Extending Rules in C++ Analysers on how to create the rules