pio check

Helper command for Static Code Analysis.

Usage

pio check [OPTIONS]

Description

Perform static analysis check on PlatformIO based project. By default Cppcheck analysis tool is used.

More details about PlatformIO Static Code Analysis.

Options

-e, --environment

Process specified environments.

-f, --src-filters

New in version 6.1.7.

You can specify which source files or folders should be included/excluded from check process. By default only src_dir and include_dir are checked. Multiple --src-filters options and GLOB Patterns are allowed.

Example: pio check --src-filters="+<src/app/>" --src-filters="-<src/app/uart/>"

--flags

Specify additional flags that need to be passed to the analysis tool. If multiple tools set in check_tool option, the flags are passed to all of them. Individual flags for each tool can be added using a special suffix with the tool name.

Flag

Meaning

--addon=<addon>

Execute addon. i.e. cert.

-D<ID>

Define preprocessor symbol.

Multiple --flags options are allowed.

Example: pio check --flags "-DDEBUG cppcheck: --std=c++11 --platform=avr8"

--severity

Specify the Defect severity types which will be reported by the Check tools. Possible values described in Defect severity section. Multiple --severity options are allowed.

Example: pio check --severity=high

-d, --project-dir

Specify the path to project directory. By default, --project-dir is equal to the current working directory (CWD).

-c, --project-conf

Process project with a custom “platformio.ini” (Project Configuration File).

--json-output

Return the output in JSON format.

--fail-on-defect

Fail (exit with non-zero code) if there is a defect found with specified severity. By default exit code is the same as the exit code returned by a tool selected for performing check. Possible values described in Defect severity section. Multiple --fail-on-defect options are allowed.

Example: pio check --fail-on-defect=low --fail-on-defect=medium

--skip-packages

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.

Example: pio check --skip-packages

-s, --silent

Suppress progress reporting and show only defects with high severity. See Defect severity.

-v, --verbose

Show detailed information when processing environments.

This option can also be set globally using force_verbose setting or by environment variable PLATFORMIO_SETTING_FORCE_VERBOSE.

Examples

For the examples please follow to Static Code Analysis page.