Skip to content

fbuild: add cppcheck / static-analysis support (currently PIO-only) #2301

Closed

Description

@zackees

Problem

ci/ci-cppcheck.py is the only entry point for C++ static analysis in FastLED CI. It works by:

  1. Searching .build/pio/<board>/ for a platformio.ini.
  2. cd-ing into that project dir.
  3. Invoking pio check --skip-packages --src-filters=+<src/> --severity=medium --fail-on-defect=high ....

This pipeline assumes PlatformIO was the backend that compiled the board. When fbuild is the active backend (as on esp32c2, esp32s3, esp32c3, esp32c6 today, expanding over time), the partition CSV (e.g. huge_app.csv) and other IDF-side build metadata never get copied into .build/pio/<board>/, so pio check fails during CMake configure with:

Missing partition table file `/home/runner/work/FastLED/FastLED/trusted/.build/pio/esp32c2/huge_app.csv`
UserSideException: Processing esp32c2 ...

See the esp32c2 workflow on master, red every run since #2292: https://github.com/FastLED/FastLED/actions/workflows/esp32c2.yml?query=branch%3Amaster

Confirmation that fbuild has no check feature

ci/util/fbuild_adapter.py exposes only:

  • fbuild_build_and_upload
  • fbuild_build_only
  • is_fbuild_available
  • get_fbuild_version

No check / lint / analyze / cppcheck API. The underlying fbuild daemon (per ci/util/fbuild_runner.py) is a compile-and-cache tool; static analysis is out of its current scope.

What needs to happen

ci/ci-cppcheck.py (and any future lint/analysis step) must work against fbuild-compiled boards. Two reasonable directions:

  1. Direct cppcheck invocation against fbuild output. Use fbuild's compile_commands.json (or derive it) and run cppcheck directly, bypassing pio check entirely. Benefits: no PIO project-tree assumption, no partition-CSV dependency, faster.
  2. Mirror the PIO metadata fbuild needs for pio check. Populate .build/pio/<board>/<Example>/ with whatever pio check needs — resolved huge_app.csv, sdkconfig, etc. — regardless of which backend compiled. This reuses the old mirror pattern that refactor(ci): drop fbuild→.pio mirror; read merged-bin from active backend #2299 just dropped for merged-bin, but only for the cppcheck scope.

Option 1 is cleaner architecturally and removes the PIO dependency for analysis. Option 2 is easier to get landed but keeps the backend-coupling that #2299 was moving away from.

Scope

  • ci/ci-cppcheck.py — rework to detect backend and dispatch appropriately
  • ci/util/fbuild_adapter.py — optionally add a fbuild_cppcheck helper (or expose compile_commands.json location)
  • Workflow YAMLs (esp32c2.yml, etc.) — no change needed if the script handles it transparently

Blocks

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions