Repository navigation
Description
Follow-up to #3288 / PR #3293. PR #3293 migrated 60 single-file checkers to the Rust crate (ci/lint_cpp_rs/, binary fastled-lint) and made it the default lint path. 10 Python .py files remain in the cpp lint pipeline outside the orchestrator/glue layer. This issue covers porting them so the .py files can be deleted.
Verification command (use to track progress)
ls ci/lint_cpp/*.py ci/tools/check_noexcept.py ci/tools/check_array_params.py 2>/dev/null \
| grep -vE "/(rust_binary_cache|rust_bridge|run_all_checkers|test_noexcept_checker|test_public_settings_pattern_checker)\.py$"Today this prints 11 lines (5 Tier-1 + 1 Tier-2 + 4 Tier-3 + 3 Tier-4 = 13 paths minus 2 dropped tests).
This issue is DONE when only the Tier-4 AST ratchet trio prints (noexcept_checker.py, check_noexcept.py, check_array_params.py — 3 lines). Those are explicitly out-of-scope per #3288.
Scope (port these to Rust, in this order)
Tier 1 — pure regex, single-file (port first)
ci/lint_cpp/bare_libm_checker.py→BareLibmCheckerci/lint_cpp/bare_snprintf_checker.py→BareSnprintfCheckerci/lint_cpp/bare_noinline_checker.py→BareNoInlineCheckerci/lint_cpp/fl_no_underscore_checker.py→FlNoUnderscoreCheckerci/lint_cpp/legacy_log_macro_checker.py→LegacyLogMacroChecker
Tier 2 — regex + one-time read of src/FastLED.h
ci/lint_cpp/public_settings_pattern_checker.py→PublicSettingsPatternChecker
Tier 3 — cross-file structural walks (port last)
ci/lint_cpp/pch_file_checker.py— bans.pchfiles in the repoci/lint_cpp/test_unity_build.py—_build.hpphierarchy walkerci/lint_cpp/test_aggregation_checker.py— test aggregator-parent walkerci/lint_cpp/iwyu_pragma_check.py— standalone IWYU pragma validation
OUT OF SCOPE per #3288 — DO NOT port
ci/lint_cpp/noexcept_checker.py(clang-query AST ratchet)ci/tools/check_noexcept.pyci/tools/check_array_params.py
Per-checker port recipe
For each item in Tiers 1–3:
- Read the Python source in full. Note: regex patterns, suppression comments (
// nolint,// ok …), exempt-file lists, scope filtering, and any edge-case handling. EVERY rule must move verbatim. - Add a Rust struct +
impl FileContentCheckerto theci/lint_cpp_rs/src/checkers/file whose policy area matches (seeci/lint_cpp_rs/src/checkers/README.mdfor the grouping). Tier-1 "bare X" checkers fitbasic.rs.PublicSettingsPatternCheckerfitsruntime.rs. - Pre-compile any new regex via the regex accessor pattern in
ci/lint_cpp_rs/src/lint_core/regexes.rs. - Register at three sites in
ci/lint_cpp_rs/src/lint_core/processor_registry_cli.rs:supported_checker_names(),supported_python_checker_names(),create_checkers(). - Add the Python class name to
RUST_SUPPORTED_CHECKERSinci/lint_cpp/rust_bridge.pyso the orchestrator skips the Python copy. - Add inline
#[cfg(test)] mod testsexercising the same edge cases the Python checker's tests covered (look atci/lint_cpp/test_*.pyif a test file exists, otherwise hand-roll positive + negative cases). - Run
FL_LINT_AB=1 uv run python ci/lint_cpp/run_all_checkers.pyafter each port and confirm A/B parity holds. If it fails, fix the Rust impl until it matches Python on the live tree. - Once A/B is green for that checker, delete the Python file (
git rm ci/lint_cpp/<name>_checker.py) plus its test file if any (git rm ci/lint_cpp/test_<name>_checker.pyand anyci/tests/test_*exercising it). Remove the import + instantiation inci/lint_cpp/run_all_checkers.py.
Special-case: PublicSettingsPatternChecker
Python implementation lazy-loads src/FastLED.h once to verify that each set_*/enable_*/disable_*/use_* free function in src/fl/**/*.h has a matching CFastLED::setX() wrapper. In Rust, do the FastLED.h read once at checker construction time (or behind a std::sync::OnceLock) and reuse the parsed set of wrapper names across calls. Preserve GRANDFATHERED_NAMES and FUNCTION_POINTER_SETTERS allowlists verbatim — they exist for a reason (see PR refs in the docstring).
Special-case: Tier 3 cross-file walkers
Each one does a one-shot walk over a directory tree at lint time. The Rust dispatcher's MultiCheckerFileProcessor is per-file, so the cleanest port is as a standalone Rust function called from ci/lint_cpp_rs/src/main.rs (or as a separate "pass" function invoked alongside the per-file checker pass), with its violations merged into the same output. Look at how the Python orchestrator calls run_unity_build_check(), run_test_aggregation_check(), check_pch_files() from ci/lint_cpp/run_all_checkers.py for the contract.
If a Tier-3 port turns out to be substantially more involved than its Python original, document the gap on this issue and leave that one for a follow-up — do not block the simpler ports behind it.
Hard constraints
- DO NOT widen scope. Single PR (or short stack) onto
master; if it grows past ~12 ported checkers in one push, split it. - DO NOT delete the Python file until A/B parity passes for the Rust port that replaces it.
- DO NOT touch the AST ratchet trio (Tier 4) — Mandatory C++ linter migration: Rust-only via build-on-change cache, retire Python checkers #3288 explicitly out-of-scopes them. If you think they should move, file a separate issue.
- DO NOT introduce new dependencies in
ci/lint_cpp_rs/Cargo.tomlunless strictly required. The existingregex/rayon/serde/walkdir/globset has covered every port so far. - Use
bash lintexclusively for verification — never barecargo/meson/ninja(hook will block).
Acceptance criteria
- Tier 1 ported (5 checkers).
- Tier 2 ported (1 checker).
- Tier 3 ported (4 checkers — OR a clear gap-analysis comment on each that couldn't be ported, with a follow-up issue link).
- Verification command above prints only the 3 Tier-4 entries.
-
FL_LINT_AB=1 uv run python ci/lint_cpp/run_all_checkers.pypasses after each port and at the end. -
bash lint --cppgreen. - No external file imports any of the deleted Python checker modules (verify via
rg \"from ci\.lint_cpp\.(bare_libm|bare_noinline|bare_snprintf|fl_no_underscore|legacy_log_macro|public_settings_pattern|pch_file|test_unity_build|test_aggregation|iwyu_pragma)\" --glob '!.claude/worktrees' --glob '!**/__pycache__').
Codebase-wide search terms (for grep/rg)
BareLibmChecker|BareNoInlineChecker|BareSnprintfChecker|FlNoUnderscoreChecker|LegacyLogMacroChecker|PublicSettingsPatternChecker|bare_libm_checker|bare_noinline_checker|bare_snprintf_checker|fl_no_underscore_checker|legacy_log_macro_checker|public_settings_pattern_checker|pch_file_checker|test_unity_build|test_aggregation_checker|iwyu_pragma_check
After porting each item, the corresponding identifier should appear only inside the Rust crate, or vanish entirely.
Related
- Mandatory C++ linter migration: Rust-only via build-on-change cache, retire Python checkers #3288 — parent migration issue
- feat(lint): retire Python C++ checkers; Rust fastled-lint is default (#3288) #3293 — PR landing the Rust default + 60-checker retirement
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
feat(lint): port Tier 1+2+pch_file Python checkers to Rust (#3297)
zackees commentedon Jun 19, 2026
Progress update — 7 of 10 ported in PR #3293
Commit
ec549271eon PR #3293 lands the Tier-1 fleet plus PublicSettingsPatternChecker plus PchFileChecker. Verification command output trimmed from 11 → 6 unfinished entries:Three are the explicitly-out-of-scope Tier-4 AST ratchets. Three remain on this issue.
Done in this PR
BareLibmChecker,BareNoInlineChecker,BareSnprintfChecker,FlNoUnderscoreChecker,LegacyLogMacroChecker. Land in newci/lint_cpp_rs/src/checkers/bare_legacy.rssharing apython_style_pass_through_linehelper that mirrors the Python block-comment +//line +// ok <suppress>semantics exactly. Regex lookbehinds replaced by small post-match*_has_qualifier_prefixpredicates.PublicSettingsPatternChecker. Readssrc/FastLED.honce throughOnceLock<String>keyed off the project root. PreservesGRANDFATHERED_NAMES+FUNCTION_POINTER_SETTERSallowlists and the per-object setter heuristic verbatim.PchFileChecker. The per-file dispatcher walks only.cpp/.h/.hpp/.ino/.cpp.hpp, so.pchdetection needs its own walk. Newci/lint_cpp_rs/src/checkers/structural_passes.rshostsrun_structural_passes(), invoked fromrun_cliafter the per-file pass when no explicit input paths are supplied. This is the template the remaining Tier-3 walkers will fill in.Deferred to follow-up PRs (still on this issue)
iwyu_pragma_check.py(135 lines) — standalone IWYU pragma validation. Fits the structural-pass model already in place; the port is mostly mechanical. Estimated ~150 lines of Rust.test_aggregation_checker.py(255 lines) —tests/aggregator-parent walker. Note: a per-fileTestAggregationCheckerwas already ported in feat(lint): retire Python C++ checkers; Rust fastled-lint is default (#3288) #3293; the cross-filecheck()/check_single_file()orchestrator-side calls that remain are what need to move. Estimated ~250 lines of Rust on top of the structural-pass hook.test_unity_build.py(1204 lines) —_build.hpphierarchy walker. Large surface area, cross-references many test directories, and would push a single Rust file past the project's 1000-line-per-source cap. Needs its own focused PR with split files. Estimated ~1100 lines of Rust split across 2-3 files.The 3 deferrals follow the issue's own escape hatch: "If a Tier-3 port turns out to be substantially more involved than its Python original, document the gap on this issue and leave that one for a follow-up — do not block the simpler ports behind it."
Verification
FL_LINT_AB=1 uv run python ci/lint_cpp/run_all_checkers.py→ Rust/Python parity holds for all 67 ported checkers (60 from feat(lint): retire Python C++ checkers; Rust fastled-lint is default (#3288) #3293 + 6 single-file + 1 structural).bash lint --cpp→ green.uv run python ci/lint_cpp/rust_binary_cache.py→ rebuilds once after the crate edits, then no-ops.pyrightclean on changed Python files.RUST_SUPPORTED_CHECKERSinci/lint_cpp/rust_bridge.pyis now at 67 entries.feat(lint): finish #3297 — port remaining Tier-3 walkers to Rust
zackees commentedon Jun 19, 2026
Closed: migration complete within stated bounds.
Validation
Reproduction case from the issue body:
Output as of PR #3293 commit `ea9f69a5d`:
Three lines — the Tier-4 AST ratchet trio. Acceptance criterion ("only Tier-4 entries print") is satisfied.
Final port summary
Verification
Out of scope (intentionally left as Python)
The three remaining files in the verification command output are the Tier-4 clang-query AST ratchets that #3288 explicitly out-of-scoped. Porting them would require a Rust libclang binding and is tracked separately.
PR #3293 is open with the full migration; this issue auto-closes once the PR merges (via `Closes #3297` in the PR body).
feat(lint): retire Python C++ checkers; Rust fastled-lint is default (#…