To run Cppcheck aross all C and C++ files in your project and save the output in a machine readable format, the following command can be used in Execute shell (for freestyle projects):
cppcheck --enable=all --inconclusive --xml --xml-version=2 . 2> cppcheck.xml
You can then add a post-build action to Publish Cppcheck results; in the
Cppcheck report XMLs field you can then enter the
cppcheck.xml created above.
Under the Cppcheck XML input, you can also select Advanced..., which allows you
to configure the graph and thresholds, so that the build will become unstable
or fail if the number of issues found by Cppcheck is above a certain value.
As builds are completed, a graph will now be created on the job page, showing the number of Cppcheck errors across the builds. Click on the graph or Cppcheck Results to see the detailed Cppcheck results for the most recent build. Click on some of the links on that page to see the source code with the errors highlighted. To see results for a specific build, click on Cppcheck Results from that specific build page.
GNU Compiler Warnings
You can run the gcc compiler with warnings on and publish the results
graphically. Use the
-Wall flag, or any other desired warning flags when
compiling (see compiler documentation). Then add a post-build action Scan for
compiler warnings, choose Add under Scan console log and then GNU C
As builds are completed, this will create a graph on the job page showing the number of compiler warnings across the builds. Click on the graph or GNU C Compiler Warnings to see a summary of the warnings for the most recent build. Click on the Warnings tab to see the files, line numbers and error messages , and click on an error to see the source code with the error highlighted. To see results for a specific build, click on GNU C Compiler Warnings from that specific build page.