Check options

See also

Please make sure to read Static Code Analysis guide first.

check_tool

Type: String | Multiple: Yes | Default: cppcheck

A name of the check tool used for analysis. This option is useful when you want to check source code with two or more tools.

See available tools in Check tools.

Example

[env:myenv]
platform = ...
board = ...
check_tool = cppcheck, clangtidy

check_patterns

Type: String (Pattern) | Multiple: Yes

This option allows specifying which source files or folders should be included/excluded from the check process. GLOB Patterns are allowed. src_dir and include_dir folders are checked by default.

Another option for filtering source files is pio check --pattern command.

Example

[env:custom_check_patterns]
platform = ...
board = ...
check_tool = clangtidy
check_patterns =
  app/sources
  tests/hardware/*.c

check_flags

Type: String | Multiple: Yes

Additional flags to be passed to the tool command line. This option is useful when you want to adjust the check process to fit your project requirements. By default, the flags are passed to all tools specified in check_tool section. To set individual flags, define tool name at the beginning of the line.

Another option for adding flags is pio check --flags command.

Example

[env:extra_check_flags]
platform = ...
board = ...
check_tool = cppcheck, clangtidy
check_flags =
  --common-flag
  cppcheck: --enable=performance --inline-suppr
  clangtidy: -fix-errors -format-style=mozilla

check_severity

Type: String | Multiple: Yes | Default: low, medium, high

This option allows specifying the Defect severity types which will be reported by the Check tools.

Another option for filtering source files is pio check --severity command.

Example

[env:detect_only_medium_or_high_defects]
platform = ...
board = ...
check_severity = medium, high

check_skip_packages

Type: Bool (yes or no) | Multiple: No | Default: no

Exclude underlying third-party packages from the checking process. By default, PlatformIO passes frameworks and toolchains include paths required by internal analysis tools to properly analyze project sources. Some of the supported analysis tools use their own preprocessor which may fail to parse perfectly valid code and thus provide empty or partial check reports. This option is useful when developers have no control over this third-party code and want to perform analysis at least on project sources.

Another option for excluding third-party packages is pio check --skip-packages command.

Example

[env:extra_check_flags]
platform = ...
board = ...
check_tool = cppcheck, clangtidy
check_skip_packages = yes