Our team previously used Lint as a static code analyser, but it became too cluttered and had too much noise.
We are using C++03 with frequent use of Boost, and Lint didn't seem to like Boost (I hear this has become better in later versions). I started looking at other static code analysers and came across Cppcheck and tried it out. I'm very impressed at what it warns about (I've seen about a dozen informationals and style problems).
What I'm interested in is: Is there are a list of all Cppcheck messages that Cppcheck issues, similar to how Lint and PVS-Studio both have a list of their messages? The official Cppcheck website lists:
But I'm more interested in something similar to Lint and PVS-Studio, and similar to how the results are displayed in Visual Studio:
ID | Category/Severity | Text
According to the cppcheck help: The error id is the id that you want to suppress. The easiest way to get it is to use the --xml command line flag. Copy and paste the id string from the xml output.
Cppcheck is automatically run on open files. To select the files to check in the currently active project, select Analyze > Cppcheck.
A list of Cppcheck checks is available at the project's wiki, and as stated there, you can also get the list from the command-line by running:
$ cppcheck --doc
or
$ cppcheck --errorlist
The errorlist outputs an XML file with all three things you want. Here's a small example from it:
<error id="unnecessaryForwardDeclaration" severity="style" msg="The variable 'name' forward declaration is unnecessary. Type variable is already declared earlier."/>
<error id="variableHidingEnum" severity="style" msg="variable 'name' hides enumerator with same name"/>
<error id="unnecessaryQualification" severity="style" msg="The extra qualification 'type' is unnecessary and is considered an error by many compilers."/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With