platformio/platformio-core

Allow to change Include paths for cppcheck

Open

#4,398 创建于 2022年8月20日

在 GitHub 查看
 (3 评论) (0 反应) (1 负责人)Python (791 fork)batch import
help wantedstatic analysis

仓库指标

Star
 (7,329 star)
PR 合并指标
 (平均合并 109天 16小时) (30 天内合并 5 个 PR)

描述

  • 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.

贡献者指南