Skip to content

docs(lint): stop LegacyLogMacroChecker claiming a cost the suffix cannot control (#4297) - #4396

Merged
zackees merged 1 commit into
masterfrom
docs/4297-checker-rationale
Sep 12, 2026
Merged

zackees merged 1 commit into
masterfrom
docs/4297-checker-rationale

Conversation

@zackees

@zackees zackees commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

Addresses the factual half of #4297 without taking its decision.

The false claim

LegacyLogMacroChecker's header said each call site

should use the _F printf-style variant so the formatter lives in fl::printf instead of a fresh fl::sstream chain per call site

That is not achievable by the spelling. src/fl/log/log.h:330:

#define FL_WARN_F(...) FL_WARN(__VA_ARGS__)

The two are the same token sequence. What selects log_emit_f over log_emit is the argument count — one argument builds an fl::sstream, two or more do not — and the suffix has no bearing on it. I verified the identity by preprocessing rather than by taking the issue's word for it.

Stating a false mechanism in the checker is worse than stating nothing: it sends the next reader looking for a cost the rule does not control, and it is the justification someone would cite when deciding whether to keep the rule.

What this changes

The comment only. Behaviour is unchanged — the rule still enforces the _F spelling and still has no suppression.

The comment now says what the rule actually enforces, and records the contradiction at the place someone hits it: log.h tells new code to drop the suffix and "rely on argument-count dispatch", the opposite instruction, and per #4297 more than half the _F calls this rule approves are single-argument ones that build the sstream anyway.

What it deliberately does not do

Resolve #4297. That issue's option (1) is a lint rewrite over 1,760 call sites, and its option (2) retires a rule with no suppression — both decisions, not cleanups. The comment says so explicitly so the next person does not mistake an accurate rationale for a settled question.

bash lint clean; the crate's own 105 tests pass.

Comment-only; no behaviour change.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9

Summary by CodeRabbit

  • Documentation
    • Corrected internal documentation describing how formatted logging macros select their logging behavior.
    • Clarified that argument count, rather than the macro suffix, determines the underlying logging path.

…not control

The checker's header said each call site "should use the `_F` printf-style
variant so the formatter lives in fl::printf instead of a fresh fl::sstream
chain per call site". That is not achievable by the spelling, and stating it
here sent readers looking for a cost the suffix does not control.
`src/fl/log/log.h:330` is:

    #define FL_WARN_F(...) FL_WARN(__VA_ARGS__)

so the two are the same token sequence. What selects `log_emit_f` over
`log_emit` is the argument count -- one argument builds an `fl::sstream`, two
or more do not.

Behaviour is unchanged. The comment now says what the rule enforces, which is
a spelling, and points at #4297 for whether that is the right rule: `log.h`
tells new code to drop the suffix and "rely on argument-count dispatch", the
opposite instruction, and more than half the `_F` calls this rule approves are
single-argument ones that build the sstream anyway. That contradiction is a
decision with 1,760 call sites in scope; this change deliberately does not
take it, and says so.

Verified the macro identity by preprocessing rather than by reading the issue.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9
@zackees
zackees merged commit df36a29 into master Sep 12, 2026
25 of 26 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Sep 12, 2026
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Sep 12, 2026
@coderabbitai

coderabbitai Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 2de508c7-bfab-492d-bb0a-33e53b4489ae

📥 Commits

Reviewing files that changed from the base of the PR and between 48fc951 and b1e27e2.

📒 Files selected for processing (1)
  • ci/lint_cpp_rs/src/checkers/bare_legacy.rs

📝 Walkthrough

Walkthrough

The pull request updates the LegacyLogMacroChecker documentation. It removes an incorrect claim about the _F suffix and documents argument-count dispatch instead. No code behavior changes.

Changes

Logging checker documentation

Layer / File(s) Summary
Correct checker rationale
ci/lint_cpp_rs/src/checkers/bare_legacy.rs
The documentation states that FL_WARN_F expands to FL_WARN and that argument count selects log_emit_f or log_emit. It also records the spelling-consistency rationale and references issue 4297.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other · Severity of issue fixed: Low

✨ 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 docs/4297-checker-rationale

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.

@zackees
zackees deleted the docs/4297-checker-rationale 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.

LegacyLogMacroChecker enforces a spelling that cannot achieve its stated goal, and contradicts log.h

1 participant