codeclimate-cppcheck is a Code Climate engine that wraps Cppcheck.
You can run it on your command line using the Code Climate CLI, or on our
hosted analysis platform.
Cppcheck is a static analysis tool for C/C++ code.
- If you haven't already, install the Code Climate CLI.
- Run
codeclimate engines:enable cppcheck. This command both installs the engine and enables it in your.codeclimate.ymlfile. - You're ready to analyze! Browse into your project's folder and run
codeclimate analyze.
Like the cppcheck command line tool itself, you can configure various
aspects of the static analysis. Right now, the following options are supported
in .codeclimate.yml:
check: issue categories to check. Available values are:all,warning,style,performance,portability,information,unusedFunction, etc. Refer to the--enable=option ofcppcheckfor more information.project: use Visual Studio project/solution (*.vcxproj/*sln) or compile database (compile_commands.json) for files to analyse, include paths, defines, platform and undefines. Refer to the--project=option ofcppcheckfor more information.language: forcescppcheckto check all files as the given language. Valid values are:c,c++. Refer to the--language=option ofcppcheckfor more information.stds: multiple language standards to check against. Refer to the--std=option ofcppcheckfor more information.platform: specifies platform specific types and sizes. Available builtin platforms are:unix32,unix64,win32A,win32W,win64, etc. Refer to the--platform=option ofcppcheckfor more information.defines: define preprocessor symbols. Refer to the-Doption ofcppcheckfor more information.undefines: undefine preprocessor symbols. Refer to the-Uoption ofcppcheckfor more information.includes: paths for searching include files. First given path is searched for contained header files first. If paths are relative to source files, this is not needed. Refer to the-Ioption ofcppcheckfor more information.max_configs: maximum number of configurations to check in a file before skipping it. Default is '12'. Refer to the--max-configs=option ofcppcheckfor more information.inconclusive: allow reporting issues that are not inconclusive. Refer to the--inconclusiveoption ofcppcheckfor more information.
Additional options may be supported later.
An example .codeclimate.yml file:
engines:
cppcheck:
enabled: true
config:
check: all
project: compile_commands.json
language: c++
stds:
- c++11
platform: unix64
defines:
- "DEBUG=1"
- "__cplusplus"
undefines:
- "DEBUG"
includes:
- include/
max_configs: 42
inconclusive: falseFor help with Cppcheck, check out their documentation.
If you're running into a Code Climate issue, first look over this project's GitHub Issues, as your question may have already been covered. If not, go ahead and open a support ticket with us.