platformio / platformio/platformio-core

Allow to change Include paths for cppcheck

Open
#4,398 3 comments 0 reactions 1 assignee View on GitHub

@valeros is already working on this.

Since Aug 24, 2022.

help wanted static analysis
Dominant language
Python
Stars
9.5k
Forks
905
Avg merge
2d 13h
Merged PRs (30d)
2

Description

  • Feature Request.

Configuration

Operating system:

PlatformIO Version (platformio --version):
PlatformIO Core, version 6.1.4

Description of problem

Lack of ability to exclude Includes from cppcheck analysis. Long analysis and a long output.
Related conversation.

Steps to Reproduce
  1. Create project which includes hal headers from within the repository.
  2. Setup cppcheck with misra check:
  3. Perform static analysis platformio.exe check
Actual Results

Analysis that is slow and outputs thousands of MISRA violations

Component     HIGH    MEDIUM    LOW
-----------  ------  --------  -----
src            0        0        4
src\CMSIS      0        0      1173
src\Device     0        0      8279

Total          0        0      9456

Environment         Tool      Status    Duration
------------------  --------  --------  ------------
genericSTM32F103C8  cppcheck  PASSED    00:00:19.038
Expected Results

A quick analysis of user code only without entering hal headers

Component     HIGH    MEDIUM    LOW
-----------  ------  --------  -----
src            0        0        4

Total          0        0      4

Environment         Tool      Status    Duration
------------------  --------  --------  ------------
genericSTM32F103C8  cppcheck  PASSED    00:00:1.234
If problems with PlatformIO Build System:

The content of platformio.ini:

[env:genericSTM32F103C8]
platform = ststm32
board = genericSTM32F103C8
board_build.ldscript = src/Device/STM32F103XB_FLASH.ld
build_flags =
    -Isrc/CMSIS/
    -Isrc/Device

check_skip_packages = yes ;don't inlcude compiler package inludes
check_patterns = 
  src/*.c
  src/*.h
check_flags =
  cppcheck:--addon=misra --suppress=suppress.txt

Source file to reproduce issue:
Working example:
https://github.com/dzid26/pio-exclude-cppcheck.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.