Here is a quick guide how to run the supported analyzers and generate reports such that it fits SonarQube's needs.
In order to run Cppcheck and generate a fitting report, make sure:
- to pass all include directories as otherwise the analysis will be incomplete
- that the <sources> parameter matches the sonar.sources list in sonar-project.properties
- to create a XML report 'version 1' using the parameters "
- to get the report from the standard error channel
A Cppcheck run may take a while on a big code base. To cut down analysis times, check the following options:
-j Noption to run N workers in parallel
- Use only checks you're interested in via the option
- Restrict checking of preprocessor configurations using
- Get a faster machine
SonarQube can be fed with results of a Valgrind/Memcheck analysis. That's very valuable because:
- due to its dynamic nature, the false positives rate is very low (Given good maintained suppression files, of course)
- it is able to find serious issues which are often hard to detect otherwise
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.
Vera++ does static C++ code checking, focusing mostly on style issues.
To feed Vera++ analysis results into SonarQube:
- Find all the files we want to be analysed
- Pipe this list into Vera++ and
- Pipe the resulting output into a Perl script which finally generates the required XML.
RATS stands for "Rough Auditing Tool for Security". This tool performs static C++ code checks focusing mainly on security issues. Just tell it to create XML output and redirect the standard channel into a file.
The Pc-Lint XML output needs to be formated to fit SonarQube.
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)