Cppcheck

Store Cppcheck results to a running CodeChecker server

Cppcheck is a static analysis tool for C/C++ code.

The recommended way of running the CppCheck tool is to use a JSON Compilation Database file.

The following example shows how to log the compilation commands with CodeChecker, run CppCheck and store the results found by CppCheck to the CodeChecker database.

# collect the compilation commands with absolute path conversion
# absolute path conversion is required so the reports generated by Cppcheck can be stored
CC_LOGGER_ABS_PATH=1 CodeChecker log -o compile_command.json -b "make"

# create a directory for the reports
mkdir cppcheck_reports

# run cppcheck
# use the compile command database and generate the reports in plist format
cppcheck --project=compile_command.json --plist-output=./cppcheck_reports

# store the cppcheck reports with CodeChecker
CodeChecker store cppcheck_reports -n cppcheck

For more information about logging checkout the log section in the user guide.

Note
Analysis related information can not be stored since it is not collected by CppCheck: analysis statistics, analysis duration, cppcheck command

The missing unique report identifiers are generated only during the storage process by CodeChecker.

Comparison of local and stored Cppcheck reports

Cppcheck does not generate a unique report identifier. Without such a unique id local and remote report comparison can not be done right now.