Skip to content

lint: inspect code adjacent to block comments in bare legacy checkers #3946

Closed

Description

@zackees

Problem

The five legacy single-line Rust lint checkers in ci/lint_cpp_rs/src/checkers/bare_legacy.rs share python_style_pass_through_line(). Its block-comment state machine skips the entire line whenever a multiline block comment opens or closes, and it does not strip same-line /* ... */ comments.

This preserves a false-negative/false-positive bug from the retired Python checker that CodeRabbit identified on PR #2830: #2830 (comment)

The bug is still present on current master after the Rust migration in #3297:

  • banned_call(); /* comment starts is skipped, so real code before /* is not checked.
  • */ banned_call(); is skipped, so real code after */ is not checked.
  • /* banned_call(); */ is scanned as code, so a token inside a one-line block comment can be reported.

The shared helper affects BareNoInlineChecker, BareSnprintfChecker, BareLibmChecker, FlNoUnderscoreChecker, and LegacyLogMacroChecker.

Smallest fix

Use the existing strip_block_comments_from_line() helper before each affected checker inspects code, preserving visible code on both sides of block-comment spans. Apply line-comment splitting and per-rule suppression checks to the stripped visible text. Remove python_style_pass_through_line() once no checker depends on it.

RED -> GREEN acceptance criteria

  • Add focused Rust tests that fail before the fix for banned code before a multiline /*, banned code after a multiline */, and a banned token wholly inside a same-line /* ... */ comment.
  • Cover at least BareNoInlineChecker plus a second checker using the shared path, so the regression cannot be fixed for only one rule.
  • After the fix, visible code before/after block comments is reported, while tokens inside block comments are ignored.
  • Existing suppression comments continue to work.
  • bash lint --cpp passes.

Scope

Lint-only; no compiled FastLED behavior changes. This is a substantive unresolved review follow-up discovered while triaging #2981 and its related #2830 dispatch-size work.

Activity

  1. moved this from Triage to Done in FastLED Trackeron Aug 20, 2026
  2. added a commit that references this issue on Aug 21, 2026
    f6fa2a6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions