Repository navigation
Description
Goal
Make the Rust C++ linter (ci/lint_cpp_rs/, binary fastled-lint) the mandatory default everywhere — on-save hook, Stop hook, bash lint, and CI. Retire the Python checkers in ci/lint_cpp/*.py once the Rust port is at parity. The Rust binary should be compiled on first use and after any source change, and otherwise invoked directly with no soldr/build cost.
Current state (audit, 2026-06-19)
- Python linter: 85
.pychecker files inci/lint_cpp/, dispatched byci/lint_cpp/run_all_checkers.py. This is the default path everywhere. - Rust linter: single crate
ci/lint_cpp_rs/(packagefastled-lint), covers 60 checkers declared inRUST_SUPPORTED_CHECKERS(frozenset inci/lint_cpp/rust_bridge.py:16-79). - Activation: Rust path is opt-in behind a
--rustflag (ci/lint/args_parser.py:115-119, defaultFalse). Nothing passes it today:ci/hooks/lint-on-save.py:121— no--rustci/hooks/check-on-stop.py:377-381— no--rust.github/workflows/template_unit_test.yml:57— runs one standalone Python checker, never invokesbash lint
- soldr is NOT in
pyproject.toml(pinsfbuild==2.2.28andzccache>=1.12.7;soldris absent). Theci/hooks/rust_tool_guard.py:9-11comment assumes soldr is on PATH; if it isn't,subprocess.run([\"soldr\", ...])inrust_bridge.py:96willFileNotFoundError. - Fingerprint infrastructure already exists:
ci/fingerprint/core.py:391-583shipsTwoLayerFingerprintCacheandHashFingerprintCache, both backed by thezccache-fingerprintCLI which is guaranteed byzccache>=1.12.7inpyproject.toml. Used today byci/python_lint_cache.py,ci/cpp_lint_cache.py,ci/js_lint_cache.py.
Verdict on build strategy
Full JIT (rebuild-check on every invocation) is not required. The simpler and more robust contract is:
The
fastled-lintbinary is rebuilt only when (a) it doesn't exist yet, or (b) the Rust crate's sources changed. Otherwise the cached binary is invoked directly — zero build-tool overhead per lint call.
This sidesteps the per-invocation fingerprint-scan tax (~300–800ms on Windows) and removes the hard dependency on soldr being installed at every lint call — soldr is only needed during the rare rebuild path.
Design
1. Make Rust toolchain available
- Add
soldrtopyproject.tomlas a guaranteed dependency (or document the bootstrap step ininstallso every developer + CI runner has it before we flip the default). - Continue using
soldrto drive the actual rebuild path (it warmszccacheand the shared target tree, perci/hooks/rust_tool_guard.py:9-11). - If soldr no-op overhead still exceeds ~500ms after install, file a separate soldr upstream bug — but this issue does not depend on that, because we skip the build-tool invocation entirely on the cache-hit path.
2. Build-on-change wrapper
New helper (e.g. ci/lint_cpp/rust_binary_cache.py) that:
- Resolves the expected binary path:
ci/lint_cpp_rs/target/release/fastled-lint{,.exe}. - Computes a
HashFingerprintCacheover:ci/lint_cpp_rs/src/**/*.rsci/lint_cpp_rs/Cargo.tomlci/lint_cpp_rs/Cargo.lock- (optionally)
rust-toolchain.tomlif present
- Decision:
- Binary missing → run
soldrbuild, then update fingerprint. - Fingerprint changed → same rebuild, then update fingerprint.
- Fingerprint unchanged AND binary exists → no soldr call. Caller invokes the binary directly.
- Binary missing → run
- Caller (
rust_bridge.py) switches from the currentsoldr ... run --release --bin fastled-lint -- ...to<cached_binary_path> .... This removes per-invocation build-tool overhead.
The fingerprint key uses the same zccache-fingerprint CLI everything else in ci/ uses — no new infra.
3. Wire Rust as the default
Once the wrapper lands and parity is verified (the existing A/B mode FL_LINT_AB=1 in run_all_checkers.py:904 + rust_bridge.py:159 run_rust_ab_check already supports this):
- Flip
--rustdefault toTrueinci/lint/args_parser.py. - Update
ci/hooks/lint-on-save.py:121andci/hooks/check-on-stop.py:377-381to use the default (no change needed once default flips). - Add a CI step that runs
bash lint --cpp(which will now use Rust by default) in at least one workflow —.github/workflows/template_unit_test.ymlis the obvious target. - Keep
--no-rustas an escape hatch during the deprecation window.
4. Port the Python-only checkers
RUST_SUPPORTED_CHECKERS covers 60 checkers. Approximately 12 Python checkers remain:
BareLibmChecker,BareNoInlineChecker,BareSnprintfCheckerLegacyLogMacroCheckerPublicSettingsPatternCheckerpch_file_checker.check,test_unity_build.check,test_aggregation_checker.checkSubdirNamespaceChecker(\"net\"/\"video\"/\"task\")instances atrun_all_checkers.py:273-281- Other special-case
BannedHeadersCheckerinstances
Plus two AST-based checks that use clang-query:
run_noexcept_ast_checkinrun_all_checkers.py:565-608→ci.tools.check_noexcept.find_missing_noexceptrun_array_param_ast_checkinrun_all_checkers.py:611-652→ci.tools.check_array_params.find_decayed_array_params
These call out to the existing clang-query ratchet tools; the Rust path can keep shelling out to those Python tools, or we port them to a libclang Rust binding. Either way, this issue does not require porting them — the Rust binary can fall back to the Python AST tools as subprocesses while we get parity on the regex/text checkers.
5. Retire the Python checkers
Once all 60+ checkers have Rust equivalents and FL_LINT_AB=1 shows zero divergence for one release window:
- Delete the
.pychecker files inci/lint_cpp/*_checker.py. - Delete
ci/lint_cpp/rust_bridge.py's Python-dispatch fallback. - Delete the orphan
cpp_lint.pyat the repo root (already dead — no caller). - Keep
run_all_checkers.pyonly as the thin orchestrator that invokes the Rust binary + the AST ratchet subprocesses.
Acceptance criteria
-
soldris pinned inpyproject.toml(or bootstrapped byinstall) so it is guaranteed present. - New
ci/lint_cpp/rust_binary_cache.pybuildsfastled-linton first use and on source change; otherwise no-op. -
rust_bridge.pyinvokes the cached binary directly (no build-tool call per lint invocation). -
--rustis the default inci/lint/args_parser.py;--no-rustis the escape hatch. - At least one GitHub Actions workflow runs
bash lint --cpp(Rust path) on every PR. -
FL_LINT_AB=1parity test passes for all 60 checkers inRUST_SUPPORTED_CHECKERS. - Python
.pychecker files inci/lint_cpp/whose Rust port has parity are deleted. - On-save hook latency for the no-op case (no source change, no Rust rebuild) is measured and reported in this issue.
Out of scope
- Porting the
clang-queryAST ratchet tools (noexcept + decayed-array-param) to native Rust. Keep them as Python subprocesses for now. - Sub-500ms soldr no-op performance work. Tracked separately if needed — this design avoids invoking soldr at all on the hot path.
Related files
ci/lint_cpp/rust_bridge.py:16-79, 94-120, 159ci/lint_cpp/run_all_checkers.py:170-342, 565-652, 904-960ci/lint/args_parser.py:115-119ci/lint/stage_impls.py:226-227ci/lint_cpp_rs/Cargo.toml,ci/lint_cpp_rs/src/lib.rsci/fingerprint/core.py:391-583ci/hooks/lint-on-save.py:121ci/hooks/check-on-stop.py:377-381ci/hooks/rust_tool_guard.py:9-11.github/workflows/template_unit_test.yml:57pyproject.toml(addsoldr)cpp_lint.py(delete — orphan)
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
feat(lint): port Tier 1+2+pch_file Python checkers to Rust (#3297)
feat(lint): finish #3297 — port remaining Tier-3 walkers to Rust
fix(lint): tolerate missing clang-tool-chain-query on CI + address Co…
feat(lint): retire Python C++ checkers; Rust fastled-lint is default (#…