Repository navigation
Description
Problem
FastLED's C++ static analysis pipeline today is PlatformIO-bound:
| Tool | Entry point | Backend assumption |
|---|---|---|
| cppcheck | ci/ci-cppcheck.py → pio check |
Requires a fully-populated PIO project tree |
| include-what-you-use | ci/ci-iwyu.py → find_platformio_project_dir() → clang-tool-chain-iwyu |
Uses PIO project dir to find compile_commands.json |
Both scripts look for .build/pio/<board>/<Example>/platformio.ini, cd into it, then run the tool against that PIO project. When fbuild is the active backend (esp32c2 today, expanding), the PIO project tree either doesn't exist or is missing the files the tools need — pio check fails because PIO can't resolve huge_app.csv, and IWYU can't find a valid compile_commands.json.
Rolling back affected boards to PIO every time would defeat the whole point of the fbuild migration.
Proposal
Make fbuild a first-class citizen for static analysis and include management by integrating with github.com/zackees/clang-tool-chain-bin. That toolchain already ships the wrappers FastLED uses today:
clang-tool-chain-cpp— portable C++ compiler wrapper (already referenced inci/build_example.tomllines 53, 169 and used throughoutci/ci-iwyu.py)clang-tool-chain-iwyu— IWYU wrapper (already used viauv run clang-tool-chain-iwyu, seeci/ci-iwyu.py:602)
All of these need a compile_commands.json and source tree — not a PIO project tree. fbuild already produces compile commands via its daemon; exposing them to these tools is a much lighter integration than reconstructing a PIO project every time.
Concrete work items
- fbuild →
compile_commands.jsonexport. Confirm / add an API inci/util/fbuild_adapter.pyforget_compile_commands(board, example) -> Path. If fbuild already writes.fbuild/build/<env>/compile_commands.json, expose that path; otherwise, generate it from the daemon's build state. ci/ci-iwyu.py— backend-aware path. Detect fbuild vs PIO, point IWYU at the fbuild compile-commands file when fbuild is active. Drop thefind_platformio_project_dir()hard dependency.ci/ci-cppcheck.py— same rework. Run cppcheck directly viaclang-tool-chainrather thanpio checkwhen fbuild is active (this also frees cppcheck from PIO's CMake-configure failure mode — see fbuild: add cppcheck / static-analysis support (currently PIO-only) #2301).- Other linting/analysis tools. Once the pattern is in place, add wrappers for whatever else
clang-tool-chain-binships that we want in CI (clang-tidy, clang-format-check, etc.).
Why clang-tool-chain-bin?
- Already an approved dependency — referenced in
ci/build_example.tomlandci/ci-iwyu.py. - Ships prebuilt binaries cross-platform (Windows / macOS / Linux) so CI doesn't have to compile LLVM tooling.
- Same wrapper API for every tool → minimal per-tool glue in FastLED CI scripts.
Relation to existing issues
- fbuild: add cppcheck / static-analysis support (currently PIO-only) #2301 — fbuild cppcheck/static-analysis support (subset of this; the cppcheck piece of the work above).
- CI regression: esp32c2 CPP Check fails —
pio checkcan't resolvehuge_app.csvafter fbuild compile #2302 — esp32c2 CI regression (the immediate victim of the PIO-coupling).
This issue is the umbrella for making fbuild-compiled boards fully covered by our static-analysis stack via clang-tool-chain-bin. #2301 can be considered a subset and closed as part of this, or kept as the narrower cppcheck tracker and closed by the same PR that lands item (3) above.
Acceptance
ci/ci-iwyu.pyandci/ci-cppcheck.pyrun successfully on esp32c2 (and any other fbuild-default board) without needing a PIO project tree.- Adding future
clang-tool-chain-bintools (clang-tidy, clang-format, etc.) to CI is a ~10 LOC change, not a fresh port. - No regression on PIO-backed boards.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTriage
Activity
fix(ci): skip pio check on fbuild-compiled boards to unblock esp32c2 CI
feat(ci): route cppcheck through fbuild compile_commands.json
fix(ci): skip pio check on fbuild-compiled boards to unblock esp32c2 …
feat(ci): route static analysis through clang-tool-chain-tidy + fbuil…
feat(ci): route static analysis through clang-tool-chain-tidy + fbuil…
refactor(ci): decouple IWYU + cppcheck from PIO project tree (#2303)
refactor(ci): decouple IWYU + cppcheck from PIO project tree (#2303) (#…
feat(ci): route IWYU through clang-tool-chain-iwyu-tool + fbuild comp…
zackees commentedon Apr 19, 2026
Closing — all acceptance criteria met:
(1) fbuild →
compile_commands.jsonexport. Done viaci/util/fbuild_adapter.py::get_compile_commands()(imported and used by both entry points).(2)
ci/ci-iwyu.pybackend-aware path. Done — now importsget_compile_commandsfromfbuild_adapterand routes throughclang-tool-chain-iwyu-toolwhen fbuild is the active backend. PIO path retained as legacy fallback.(3)
ci/ci-cppcheck.pysame rework. Done — importsensure_compile_commandsandwas_compiled_with_fbuildfromfbuild_compiledb; fbuild-backed boards are routed through the compile DB rather thanpio check.(4) Framework for future
clang-tool-chain-bintools. Landed via sharedfbuild_adapter/fbuild_compiledbhelpers.Merged in: #2307 (phase A routing), #2331 (IWYU + cppcheck PIO decouple), #2338 (IWYU fail-fast on missing mappings), #2345 (final CodeRabbit nits). Verified:
esp32c2CI runs under fbuild without a PIO project tree; PIO-backed boards unchanged. Reopen if a gap surfaces.