|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.
cppcheck -v --enable=all --xml -I<include directory> <sources> 2> report.xml
Extension of cppcheck rules is possible by using [SonarQubeinstal dir]/extensions/rules/cppcheck. See Extending Rules in C++ Analysers on how to create the rules
<name>Buffer 'var' is being written before its old content has been used</name>
Buffer 'var' is being written before its old content has been used.
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.
valgrind --xml=yes --xml-file=report.xml <program> <arguments>
Extension of valgrind rules is possible by using [SonarQube 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.
find <path> -regex ".*\.cc\|.*\.hh" | vera++ - -showrules -nodup |& vera++Report2checkstyleReport.perl > report.xml
Extension of vera++ rules is possible by using [SonarQube install dir]/extensions/rules/vera++. See Extending Rules in C++ Analysers on how to create the rules
rats -w 3 --xml <sources> > report.xml
Extension of rats rules is possible by using [SonarQube install dir]/extensions/rules/rats. See Extending Rules in C++ Analysers on how to create the rules
The Pc-Lint XML output needs to be formated to fit SonarQube.
// XML options for SONAR. -v // Turn off verbosity -width(0,0) // Don't break long lines +xml(?xml version="1.0" ?) // add version information +xml(results) // Turn on XML escapes -"format=<issue file =\q%f\q line = \q%l\q number = \q%n\q desc = \q%m\q/>" -"format_specific= " -hFs1 // The height of a message should be 1 i.e. don't output the line in error -e900 // 'Successful completion message' confuses ALOA
This formating has been verifed with Pc-Lint 9.0i.
For further details on how to configure Pc-Lint please refer to product page (Official Site)
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 SonarQube
Extension of pclint rules is possible by using [SonarQube install dir]/extensions/rules/pclint. See Extending Rules in C++ Analysers on how to create the rules