Skip to content

fix(lint): #3308 PR-A small lint-infra fixes (PchFileChecker case, AST tool detection, cache Rust sources, examples lint-on-save, FL_LINT_AB retirement) - #3320

Merged
zackees merged 1 commit into
masterfrom
fix/3308a-small-fixes
Jun 20, 2026

Conversation

@zackees

@zackees zackees commented Jun 20, 2026 •

Copy link
Copy Markdown
Member

Summary

PR-A of the parallel-agent split for #3308. Five small lint-infrastructure fixes that share the same change-zone (cpp lint cache, on-save hook, Rust checker, A/B compare). No test or doc changes (PR-B/PR-C cover those).

Fixes included

  • PchFileChecker case-sensitivity (HIGH) — ci/lint_cpp_rs/src/checkers/structural_passes.rs now matches *.pch exact-case (mirrors Python's rglob("*.pch"), which is case-sensitive on Linux/macOS). Eliminates the cross-port over-flag of .PCH/.Pch files.
  • _ast_tool_unavailable over-broad (HIGH) — ci/lint_cpp/run_all_checkers.py no longer swallows arbitrary "no such file or directory" errors from clang. Requires the tool name (clang-query / clang-tool-chain-query) to co-occur with "not found" / "failed to spawn".
  • cpp_lint_cache.py Rust sources (MEDIUM) — added Cargo.toml, Cargo.lock, src/**/*.rs to the fingerprint glob list (both default + manifest path). Local edits to Rust checkers now invalidate the lint-success cache.
  • lint-on-save.py examples short-circuit (MEDIUM) — removed; the Rust path needs to run on save for examples-scope checkers (UsingNamespaceFlInExamplesChecker, ExampleSerialChecker, examples-scope BannedHeadersChecker). Fingerprint cache keeps cost low.
  • FL_LINT_AB=1 retirement (MEDIUM) — post-feat(lint): retire Python C++ checkers; Rust fastled-lint is default (#3288) #3293 the Python create_checkers() returns all-empty lists, so the A/B compare was trivially empty. Deleted run_rust_ab_check, _canonical_results, _print_diff_sample, RUST_SUPPORTED_CHECKERS, and remove_rust_supported_checkers from ci/lint_cpp/rust_bridge.py; removed the FL_LINT_AB env-var plumbing from ci/lint_cpp/run_all_checkers.py.

Drive-by: tightened a pre-existing reportUnknownVariableType pyright finding on parse_rust_json_output() with an explicit cast.

Acceptance criteria closed (4 of 9)

  • PchFileChecker case-sensitivity matches Python (Linux/macOS)
  • _ast_tool_unavailable no longer swallows real clang errors
  • cpp_lint_cache.py invalidates on Rust source edits
  • lint-on-save.py runs Rust path on examples/ C++ files
  • FL_LINT_AB infrastructure retired

Remaining items (test/doc fixups) are handled by PR-B and PR-C.

Test plan

  • uv run python ci/lint_cpp/rust_binary_cache.py — Rust binary rebuilt cleanly after structural_passes.rs change
  • uv run python ci/lint_cpp/run_all_checkers.py — passes (default Rust path)
  • bash lint --cpp — passes
  • uv run pyright ci/lint_cpp/run_all_checkers.py ci/lint_cpp/rust_bridge.py ci/cpp_lint_cache.py ci/hooks/lint-on-save.py — 0 errors

Refs #3308

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Made .pch artifact detection case-sensitive in C++ linting.
    • Improved behavior when C++ AST tooling is missing or fails, reducing misleading lint outcomes.
  • Chores

    • Improved C++ lint cache invalidation to include Rust lint sources/outputs.
    • Enabled C++ linting for examples/ files on save.
    • Simplified the Rust linter integration used during C++ lint runs.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0a6aaa8d-4734-486a-8561-9dcc1ac82663

📥 Commits

Reviewing files that changed from the base of the PR and between 19c240d and 652db57.

📒 Files selected for processing (5)
  • ci/cpp_lint_cache.py
  • ci/hooks/lint-on-save.py
  • ci/lint_cpp/run_all_checkers.py
  • ci/lint_cpp/rust_bridge.py
  • ci/lint_cpp_rs/src/checkers/structural_passes.rs
🚧 Files skipped from review as they are similar to previous changes (5)
  • ci/lint_cpp_rs/src/checkers/structural_passes.rs
  • ci/hooks/lint-on-save.py
  • ci/cpp_lint_cache.py
  • ci/lint_cpp/run_all_checkers.py
  • ci/lint_cpp/rust_bridge.py

📝 Walkthrough

Walkthrough

Removes the Rust-vs-Python A/B parity comparison infrastructure (RUST_SUPPORTED_CHECKERS, remove_rust_supported_checkers, run_rust_ab_check) from rust_bridge.py and run_all_checkers.py, simplifies Rust fast-path routing to depend solely on --rust, expands lint cache invalidation to monitor Rust source files, removes the examples/ early-return in lint-on-save.py, and fixes .pch extension detection to be case-sensitive in the Rust checker.

Changes

Rust Lint Pipeline Cleanup and Hardening

Layer / File(s) Summary
Remove A/B parity helpers from rust_bridge.py
ci/lint_cpp/rust_bridge.py
Deletes RUST_SUPPORTED_CHECKERS, remove_rust_supported_checkers, run_rust_ab_check, and diff-sample utilities; updates imports to use typing.cast; parse_rust_json_output now returns a cast-typed list and raises RuntimeError on missing valid JSON.
Simplify routing and checker filtering in run_all_checkers.py
ci/lint_cpp/run_all_checkers.py
Drops removed rust_bridge imports; use_rust_fast_path is now set directly from args.rust (not FL_LINT_AB); removes remove_rust_supported_checkers calls and run_rust_ab_check conditional exits in both single-file and all-files modes; _ast_tool_unavailable() now requires tool-name keywords alongside error keywords.
Expand cache invalidation to Rust lint sources
ci/cpp_lint_cache.py
Adds ci/lint_cpp_rs/Cargo.toml, Cargo.lock, and src/**/*.rs to _DEFAULT_CPP_LINT_GLOBS; replaces the single ci/lint_cpp/*.py append in _get_cpp_lint_patterns() with an extra_includes loop covering both Python and Rust lint files.
Remove examples/ early-return and fix .pch detection
ci/hooks/lint-on-save.py, ci/lint_cpp_rs/src/checkers/structural_passes.rs
Deletes the C++/examples short-circuit branch in lint-on-save.py; changes pch_file_pass extension check to exact lowercase "pch" match, aligning with Python's rglob("*.pch") behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#2689: Introduced the Rust-backed linter bridge that this PR refactors, specifically the ci/lint_cpp/run_all_checkers.py and ci/lint_cpp/rust_bridge.py plumbing being cleaned up.
  • FastLED/FastLED#2692: Established the RUST_SUPPORTED_CHECKERS variable and parity-test plumbing in rust_bridge.py and run_all_checkers.py that are fully removed in this PR.
  • FastLED/FastLED#3321: The main PR removes A/B parity infrastructure and RUST_SUPPORTED_CHECKERS from ci/lint_cpp/rust_bridge.py, while that PR attempts to add EmAsmClangFormatChecker into the now-deleted list.

Poem

🐇 Hop, hop — the A/B scaffolding's gone,
No more parity diffs to dwell upon!
The Rust path routes straight from --rust alone,
The .pch match is case-sharp to the bone.
Cache now watches Cargo files too,
Examples lint on save — fresh and new! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title references five specific lint-infrastructure fixes (#3308, case sensitivity, AST detection, cache, examples, FL_LINT_AB), directly summarizing the changes across all modified files.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/3308a-small-fixes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…ool_unavailable tightening, cpp_lint cache Rust sources, lint-on-save examples, FL_LINT_AB retirement)

Five small lint-infrastructure fixes from issue #3308:

1. PchFileChecker case-sensitivity divergence (HIGH)
   ci/lint_cpp_rs/src/checkers/structural_passes.rs now uses an exact-case
   ext match (Some("pch")) instead of eq_ignore_ascii_case so the Rust port
   matches Python's case-sensitive rglob("*.pch") on Linux/macOS.

2. _ast_tool_unavailable over-broad (HIGH)
   ci/lint_cpp/run_all_checkers.py: dropped the bare "no such file or
   directory" branch; now requires the clang-query tool name to co-occur
   with "not found" or "failed to spawn".

3. cpp_lint_cache.py fingerprint omits Rust sources (MEDIUM)
   ci/cpp_lint_cache.py: added Cargo.toml, Cargo.lock and src/**/*.rs to
   both the default glob list and the DependencyManifest path so local
   edits to Rust checkers force a re-lint.

4. lint-on-save.py skips examples/ C++ files (MEDIUM)
   ci/hooks/lint-on-save.py: removed the examples/ short-circuit so the
   Rust path runs on save for examples-scope checkers
   (UsingNamespaceFlInExamplesChecker, ExampleSerialChecker, etc.); the
   fingerprint cache keeps per-save cost low.

5. FL_LINT_AB=1 is functionally a no-op (MEDIUM)
   create_checkers() returns all-empty lists post-#3293, so the A/B
   compare was trivially empty. Removed run_rust_ab_check,
   _canonical_results, _print_diff_sample, RUST_SUPPORTED_CHECKERS, and
   remove_rust_supported_checkers from ci/lint_cpp/rust_bridge.py and
   stripped the FL_LINT_AB env-var plumbing from
   ci/lint_cpp/run_all_checkers.py.

Drive-by: fixed a pre-existing pyright reportUnknownVariableType warning
on parse_rust_json_output() with an explicit cast.

Refs #3308

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees force-pushed the fix/3308a-small-fixes branch from 19c240d to 652db57 Compare June 20, 2026 05:41
@zackees
zackees merged commit 5f58136 into master Jun 20, 2026
8 of 10 checks passed
@zackees
zackees deleted the fix/3308a-small-fixes branch June 20, 2026 06:24
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant