Cppcheck is a static analysis tool for C/C++ code.
Patterns to include in execution and reports.
Patterns to exclude from execution and reports.
Amount of CPU. The default machine has
0.75 CPU with
2880 MiB RAM.
Inspecode automatically specifies
-j option to Cppcheck according to this value.
-j 1 is specified by default (for
-j 2 is specified for
Below is the list of options that are supported:
Execute addon. i.e. --addon=cert. If options must be provided a json configuration is needed, see the manual for additional information about that.
--clang Import Clang AST --config-exclude=
Path (prefix) to be excluded from configuration checking. Preprocessor configurations defined in headers (but not sources) matching the prefix will not be considered for evaluation.
A file that contains a list of config-excludes
--force is used, Cppcheck will only check the given configuration when -D is used. Example: '-DDEBUG=1 -D__cplusplus'.
hide certain #ifdef <ID> code paths from checking. Example: '-UDEBUG'
* all Enable all checks. It is recommended to only use --enable=all when the whole program is scanned, because this enables unusedFunction. * warning Enable warning messages * style Enable all coding style checks. All messages with the severities 'style', 'performance' and 'portability' are enabled. * performance Enable performance messages * portability Enable portability messages * information Enable information messages * unusedFunction Check for unused functions. It is recommend to only enable this when the whole program is scanned. * missingInclude Warn if there are missing includes. For detailed information, use '--check-config'. Several ids can be given if you separate them with commas. See also --std
Example: --file-filter=*bar.cpp analyzes only files that end with bar.cpp.
filename per line. When file is '-,' the file list will be read from standard input.
-f, --force Force checking of all configurations in files. If used
together with '--max-configs=', the last option is the one that is effective.
parameters to give several paths. First given path is searched for contained header files first. If paths are relative to source files, this is not needed.
Specify directory paths to search for included header files in a text file. Add one include path per line. First given path is searched for contained header files first. If paths are relative to source files, this is not needed.
Force inclusion of a file before the checked file.
from the check. This applies only to source files so header files included by source files are not matched. Directory name is matched to all parts of the path.
--inconclusive Allow that Cppcheck reports even though the analysis is
inconclusive. There are false positives with this option. Each result must be carefully investigated before you know if it is good or bad.
--inline-suppr Enable inline suppressions. Use them by placing one or
more comments, like: '// cppcheck-suppress warningId' on the lines before the warning to suppress.
and functions. With such information Cppcheck understands your code better and therefore you get better results. The std.cfg file that is distributed with Cppcheck is loaded automatically. For more information about library files, read the manual.
--max-ctu-depth=N Max depth in whole program analysis. The default value
is 2. A larger value will mean more errors can be found but also means the analysis will be slower.
Maximum number of configurations to check in a file before skipping it. Default is '12'. If used together with '--force', the last option is the one that is effective.
Specifies platform specific types and sizes. The available builtin platforms are: * unix32 32 bit unix variant * unix64 64 bit unix variant * win32A 32 bit Windows ASCII character encoding * win32W 32 bit Windows UNICODE character encoding * win64 64 bit Windows * avr8 8 bit AVR microcontrollers * native Type sizes of host system are assumed, but no further assumptions. * unspecified Unknown type sizes
The available options are: * c89 C code is C89 compatible * c99 C code is C99 compatible * c11 C code is C11 compatible (default) * c++03 C++ code is C++03 compatible * c++11 C++ code is C++11 compatible * c++14 C++ code is C++14 compatible * c++17 C++ code is C++17 compatible * c++20 C++ code is C++20 compatible (default)
[error id]:[filename]:[line] The [filename] and [line] are optional. If [error id] is a wildcard '*', all error ids match.
6.4 XML suppressions .
<!-- --> - [`thresholds:`](../configuration/tool.html#field-thresholds) - [`num-issues:`](../configuration/tool.html#field-thresholds) In addition to general severity levels, the following tool specific severity levels can be specified: - `information` (equivalent to general severity level `info`) - `style` (equivalent to general severity level `info`) - `performance` (equivalent to general severity level `info`) - `portability` (equivalent to general severity level `info`) - [`incremental:`](../configuration/tool.html#field-incremental) true/false > **Note:** The incremental analysis is disabled if any kinds of configuration files are changed. The files recognized as configuration files are as follows: - File list files: - Files specified to `--file-list` option - [`experimental:`](../configuration/tool.html#field-experimental) No tool specific experimental options are available. ### YAML Examples - With default options: ```yaml inspecode: tools: cppcheck: default
With custom machine:
inspecode: tools: cppcheck: machine: cpu: 1.5 # 1.5 CPU, 5760 MiB RAM
With custom options:
inspecode: tools: cppcheck: options: --enable: all