Repository navigation
refactor(lint): port EM_ASM clang-format pytest to Rust; drop 3 duplicate pytests (#3308) - #3321
Conversation
…cate pytests (#3308) Issue #3308 PR-B: consolidate four duplicate Python pytests into the Rust-backed fastled-lint fast path. The Rust checker subset already covers PragmaOnceChecker, IncludeAfterNamespaceChecker and the WRONG_DEFINES set inside BannedDefineChecker, so the matching pytests under ci/tests/ were re-running the same rule on every CI invocation without adding coverage. Changes: - New EmAsmClangFormatChecker in ci/lint_cpp_rs/src/checkers/preprocessor.rs. Scope matches the original pytest exactly: walks src/platforms/wasm/ for files ending in .h or .cpp and emits one violation at line 1 when the file contains EM_ASM_ but no clang-format off marker. - Wired into supported_checker_names, supported_python_checker_names and create_checkers in processor_registry_cli.rs. - Mirrored into RUST_SUPPORTED_CHECKERS in ci/lint_cpp/rust_bridge.py so the Python orchestrator skips the legacy checker class. - Three inline tests covering the positive case, the suppression case and the out-of-scope case (src/fl/* must be ignored even when content matches the trigger pattern). - Deleted ci/tests/test_wasm_clang_format.py, test_missing_pragma_once.py, test_no_include_after_namespace.py and test_wrong_defines.py after A/B parity (matching empty violation sets and exit codes) confirmed against the live src/ tree. Verified: bash lint --cpp, uv run python ci/lint_cpp/run_all_checkers.py, and the Rust em_asm inline tests (via soldr) all pass. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
💤 Files with no reviewable changes (4)
📝 WalkthroughWalkthroughPorts ChangesEmAsmClangFormatChecker Rust port and Python test retirement
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Summary
Issue #3308 PR-B (2 of 3 critical fixes from the issue). Consolidates four duplicate Python pytests into the Rust-backed
fastled-lintfast path.EmAsmClangFormatCheckerinci/lint_cpp_rs/src/checkers/preprocessor.rsports the WASMEM_ASM_+clang-format offrule fromci/tests/test_wasm_clang_format.py— same scope (src/platforms/wasm/with.h/.cpp), same trigger (file containsEM_ASM_AND lacksclang-format off), one violation at line 1.supported_checker_names,supported_python_checker_names,create_checkers) plusRUST_SUPPORTED_CHECKERSinci/lint_cpp/rust_bridge.py.ci/tests/test_wasm_clang_format.py,test_missing_pragma_once.py,test_no_include_after_namespace.py,test_wrong_defines.py— the last three duplicatePragmaOnceChecker,IncludeAfterNamespaceChecker, and theWRONG_DEFINESblock ofBannedDefineCheckerrespectively (all verified to exist inci/lint_cpp_rs/src/checkers/). No external code imported any of the four pytests.A/B parity
Before deletion, both paths produced empty violation sets and exit 0 against the live tree:
uv run pytest ci/tests/test_wasm_clang_format.py→1 passedfastled-lint --checker em_asm_clang_format --format text→All Rust C++ linting checks passed!(exit 0)pragma_once,include_after_namespace,banned_defineRust run vs the three deleted pytests → both clean.Test plan
bash lint --cpp→ exit 0uv run python ci/lint_cpp/run_all_checkers.py→ all checks passedem_asm_*) all green (positive, negative, out-of-scope)Refs #3308.
Generated with Claude Code
Summary by CodeRabbit
New Features
Tests