Repository navigation
chore(lint): drive pre-existing bash lint violations to zero - #3496
Conversation
`bash lint --cpp` is now clean on master. Prior state was 16 pre-existing violations across 8 checkers (LPC drivers, RMT4 memory manager, AutoResearch example, UnityBuild structure) — all unrelated to the singleton-elision work that landed in #3495 but blocking any hard-fail promotion of that checker. ## Fixes by category ### Suppressions (single-line intent statements) - `rmt_memory_manager_4.h` L168: `bool free(...)` is a member function, not C free() — annotated `// ok bare allocation`. - `rmt_rx_channel_4.cpp.hpp` L605: `new RmtRxChannelImpl(pin)` is inside a `shared_ptr<>` factory for a PRIVATE impl type; `make_shared` would need to expose it. Annotated `// ok bare allocation`. - `AutoResearchPwmDmaClockless.h` L58: deep-include of the concrete engine header is intentional for the driver-specific validation harness. Annotated `// ok platform headers`. - `spi_arm_lpc_dma.h` L437/438/444: LPC DMA descriptor construction needs raw addresses. Three `// ok reinterpret cast` annotations. ### Real fixes - `channel_drivers_lpc.impl.hpp`: add missing `#include "platforms/arm/is_arm.h"` (the file uses `FL_IS_ARM_LPC_845` which requires the ARM detection header). - `lpc_sct_dma_runtime.h` L137: `fl::span<const u8>(x.data(), x.size())` → `fl::span<const u8>(x)` per SpanFromPointerChecker. ### Structural fixes - **Test relocation**: `tests/fl/channels/lpc_sct_dma_engine.cpp` → `tests/platforms/arm/lpc/drivers/sct_dma/channel_engine_lpc_sct_dma.cpp`. The test exercises a platform-specific engine, not a `fl/channels/` source file, so the mirror-source-directory convention places it under `tests/platforms/arm/lpc/drivers/sct_dma/`. - **Unity build 1-level rule**: introduced `src/platforms/arm/lpc/drivers/_build.cpp.hpp` as the intermediate hop so the parent `platforms/arm/lpc/_build.cpp.hpp` only reaches one level deep (per UnityBuildChecker convention). - **Unity section comments**: added `// begin current directory includes` and `// begin sub directory includes` markers to `platforms/arm/lpc/_build.cpp.hpp` in the required positions (immediately before their include blocks). ### New checker opt-outs (with mandatory reason strings) The two structural issues below have legitimate technical rationales that predate the linter. Rather than restructure driver code as part of a lint cleanup, added minimal file-level opt-outs to UnityBuildChecker: 1. **`UNITY_BUILD_EXCLUDE(<reason>)`** — declared in a `.cpp.hpp` file's first 15 lines. Marks the file as intentionally NOT part of the unity build. Applied to `i2s_peripheral_esp32dev_esp.cpp.hpp` whose Stage-4 `driver/gpio.h` symbol set collides with the restored classic driver as `ADC: CONFLICT!` at boot. Design rationale is documented in the `_build.cpp.hpp` header comment; the marker points reviewers to it. 2. **`UNITY_BUILD_ORDER(<reason>)`** — declared in a `_build.cpp.hpp` file. Suppresses the alphabetical-order check for cases where compile-order dependency forces non-alphabetical include. Applied to `platforms/arm/lpc/drivers/sct_dma/_build.cpp.hpp` where `lpc_sct_dma_runtime.cpp.hpp` must precede `channel_engine_lpc_sct_dma.cpp.hpp` because the engine instantiates `LpcSctDmaTransmitter` (from runtime) as a data member. Both markers require a non-empty reason argument so the rationale is visible at every review site. ## Verification - `bash lint --cpp`: ✅ All C++ linting checks passed - `bash test --cpp`: 344/344 pass Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
📝 WalkthroughWalkthroughThis PR adds UNITY_BUILD_EXCLUDE and UNITY_BUILD_ORDER suppression logic to the unity build checker, restructures LPC platform unity-build headers by introducing a new drivers subdirectory header, adds an is_arm.h include, and makes minor comment/formatting-only changes across several ESP32 and LPC driver files. ChangesUnity Build Checker Opt-outs
LPC Unity Build Restructuring and Platform Header Updates
Estimated code review effort: 2 (Simple) | ~12 minutes Possibly related PRs
✨ 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
bash lint --cppis now clean on master. Prior state: 16 pre-existing violations across 8 checkers (LPC drivers, RMT4 memory manager, AutoResearch example, UnityBuild structure) — all unrelated to #3481 but blocking any hard-fail promotion of new lint rules.Follow-up to #3495 (SingletonElisionChecker land).
What's fixed
Suppressions with
// ok <checker>annotations:free()member func inrmt_memory_manager_4.h; private-implnewinrmt_rx_channel_4.cpp.hppAutoResearchPwmDmaClockless.hspi_arm_lpc_dma.hReal fixes:
#include "platforms/arm/is_arm.h"tochannel_drivers_lpc.impl.hppfl::span<const u8>(x.data(), x.size())→fl::span<const u8>(x)inlpc_sct_dma_runtime.hStructural fixes:
tests/fl/channels/lpc_sct_dma_engine.cpp→tests/platforms/arm/lpc/drivers/sct_dma/channel_engine_lpc_sct_dma.cpp(mirrors the source layout).src/platforms/arm/lpc/drivers/_build.cpp.hpphop.// begin current directory includes/// begin sub directory includestoplatforms/arm/lpc/_build.cpp.hpp.New UnityBuildChecker escape hatches (each requires a non-empty reason):
UNITY_BUILD_EXCLUDE(<reason>)— in a.cpp.hppfile's first 15 lines, marks it as intentionally NOT part of the unity build. Applied toi2s_peripheral_esp32dev_esp.cpp.hpp(Stage-4 impl whosedriver/gpio.hsymbols collide with the restored classic driver →ADC: CONFLICT!boot loop).UNITY_BUILD_ORDER(<reason>)— in a_build.cpp.hpp, suppresses alphabetical-order check when compile-order dependency forces non-alphabetical include. Applied toplatforms/arm/lpc/drivers/sct_dma/_build.cpp.hpp(engine instantiates runtime class as member — runtime must precede engine).Test plan
bash lint --cpp— ✅ All C++ linting checks passedbash test --cpp— 344/344 pass🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Documentation