3.1.7. Cppcheck

The tool is located in tools/waf-tools.

3.1.7.1. Tool Documentation

Implements a waf tool to configure Cppcheck

For information on Cppcheck see http://cppcheck.sourceforge.net/.

f_cppcheck.add_cppcheck_task(self)

Task creator for cppcheck Attributes to be processed are:

  • config: str or node where the cppcheck configuration is stored

  • root (optional): str or node where the project root is (default: ‘.’)

  • paths (optional): list of str or nodes that should be checked (default: ‘.’)

  • exclude (optional): list of str or nodes that should be excluded (default: none)

  • addons (optional): list of addon that should be used

  • options (optional): list of options that should be passed to tool

  • misra (optional): configuration of the misra tool

  • suppressions (optional): str or node that includes warnings that should be suppressed

  • exit_code: int that should be used as exit code in error case

class f_cppcheck.compile_cppcheck_config(*args: Any, **kwargs: Any)

Bases: waflib.Task.

Compiles the cppcheck template for the provided setup

run()

Replaces the configuration variables

f_cppcheck.configure(conf)

configuration step of the Cppcheck waf tool

  • Find cppcheck

  • Search for the MISRA-C rules text

class f_cppcheck.configure_misra(*args: Any, **kwargs: Any)

Bases: waflib.Task.

Configures the misra addon

run()

Actual configuration step

class f_cppcheck.copy_cppcheck_suppressions(*args: Any, **kwargs: Any)

Bases: waflib.Task.

Copies the suppression file to the build directory

run()

Copies the file

class f_cppcheck.cppcheck(*args: Any, **kwargs: Any)

Bases: waflib.Task.

The actual cppcheck task

run()

Runs cppcheck with the provided configuration.

f_cppcheck.options(opt)

Defines options that can be passed to cppcheck tool