platformio/platformio-core

Allow to change Include paths for cppcheck

Open

#4 398 ouverte le 20 août 2022

Voir sur GitHub
 (3 commentaires) (0 réactions) (1 assigné)Python (791 forks)batch import
help wantedstatic analysis

Métriques du dépôt

Stars
 (7 329 stars)
Métriques de merge PR
 (Merge moyen 109j 16h) (5 PRs mergées en 30 j)

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.

Guide contributeur