Skip to content

feat(lint): flag a new driver-enabling define; document the template rule (#4940) - #4955

Merged
zackees merged 1 commit into
masterfrom
feat/4940-driver-enable-define-lint
Oct 28, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/4940-driver-enable-define-lint

Conversation

@zackees

@zackees zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member

Stacked on #4954. Fixes #4940. Umbrella for #4949.

Deliverables (all four)

  1. Convert each known define — done in the focused sub-issues:
    FASTLED_ALL_PINS_HARDWARE_SPI (feat(esp8266): expose hardware HSPI as Bus::SPI; retire FASTLED_ALL_PINS_HARDWARE_SPI (#4942) #4951), FASTLED_ESP8266_UART (feat(esp8266): UART WS2812 engine as Bus::UART; retire FASTLED_ESP8266_UART (#4944) #4952),
    FL_ESP8266_EMBEDDED_FS (feat(esp8266): embedded LittleFS is automatic; retire FL_ESP8266_EMBEDDED_FS (#4947) #4953). Each becomes a template-selected
    BusTraits/backend with linker elimination.
  2. Document the rule — agents/docs/cpp-standards.md: new REQUIRED section
    "Driver selection is by template, never a code-enabling define" (the
    BusTraits<Bus::X>/BusSupports<Bus::X, Chipset> shape, and why an opt-in
    #define defeats both link-elimination and compile-verification, feat(channels): compile-time Bus binding via templated ChannelConfig (eliminates Channel API binary bloat) #2428).
  3. Lint check — ci/lint_cpp/driver_enable_define_checker.py: flags a
    preprocessor guard that wraps a platforms/... include under
    src/platforms/** in an FL_*/FASTLED_* macro. Guards shipping today are
    grandfathered in driver_enable_define_amnesty.txt; new ones fail.
    Registered in run_all_checkers.py. It is Python-only because the rule needs
    the guard and the line it protects — a per-line Rust pass cannot express it.
  4. Prove elimination — uv run ci/bloat.py esp8266 on the stack vs master:
    image_flash 264,667 vs 264,671 B, RAM 6,808 vs 6,808 B → no regression
    (unused engines dead-strip).

Test plan / evidence

  • pytest ci/tests/test_driver_enable_define_checker.py — 7 passed (flagged,
    allowed, scope, and a tree-wide "amnesty still covers src/platforms" guard).
  • Wired into PY_SMOKE (guard bumped 9 → 10 in test_native_ci_modes.py).
  • ci/lint.py --strict clean on the touched files.

Note: this PR is stacked on the conversions rather than under them so its
amnesty starts from the post-conversion tree; the three conversions merge first.

…rule (#4940)

Umbrella for the ESP8266 define-elimination epic (#4949): state the rule and
guard it.

- agents/docs/cpp-standards.md: new REQUIRED section 'Driver selection is by
  template, never a code-enabling define' with the BusTraits/BusSupports shape
  and the retired offenders (FASTLED_ESP8266_UART, FASTLED_ALL_PINS_HARDWARE_SPI,
  FL_ESP8266_EMBEDDED_FS).
- ci/lint_cpp/driver_enable_define_checker.py (new): a Python FileContentChecker
  that flags a preprocessor guard wrapping a 'platforms/...' include under
  src/platforms/** in an FL_*/FASTLED_* macro -- the code-enabling-define shape.
  The guards shipping today are grandfathered in
  driver_enable_define_amnesty.txt (regenerate with --generate-amnesty); new ones
  fail. Registered in run_all_checkers.py.
- ci/tests/test_driver_enable_define_checker.py (new): flagged/allowed cases plus
  a tree-wide check that the amnesty still covers src/platforms. Wired into
  PY_SMOKE (guard in test_native_ci_modes.py bumped 9 -> 10).

The three conversions land in #4951 / #4952 / #4953; this PR is the rule + guard.

Refs #4940, #4949.
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Oct 27, 2026
@zackees
zackees changed the base branch from feat/4948-esp8266-audio-input to master October 28, 2026 00:23
@zackees
zackees merged commit f3e751f into master Oct 28, 2026
2 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Oct 28, 2026
@zackees
zackees deleted the feat/4940-driver-enable-define-lint branch November 5, 2026 05:52
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.

ESP8266: replace code-enabling defines with template selection + linker elimination

1 participant