Skip to content

fix(lint): preserve code around block comments - #3950

Merged
zackees merged 1 commit into
masterfrom
fix/3946-block-comment-lints
Aug 20, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/3946-block-comment-lints

Conversation

@zackees

@zackees zackees commented Aug 20, 2026 •

Copy link
Copy Markdown
Member

Summary

  • inspect visible code before and after multiline block-comment boundaries
  • ignore block-comment delimiters inside line comments and quoted literals
  • preserve existing suppression and legacy #define behavior

Tests

  • focused Rust block-comment tests (3 passed)
  • Rust formatting check
  • bash lint --cpp

Closes #3946

Summary by CodeRabbit

  • Bug Fixes

    • Improved linting accuracy for code containing multiline comments, inline comments, and quoted literals.
    • Prevented commented-out or string-contained text from being incorrectly flagged.
    • Preserved detection of valid code surrounding comments and suppression markers.
  • Tests

    • Added regression coverage for comment and string-literal handling across multiple C++ lint checks.

@zackees
zackees merged commit f6fa2a6 into master Aug 20, 2026
7 of 17 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Aug 20, 2026
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Aug 20, 2026
@coderabbitai

coderabbitai Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5b0dc12e-0d0d-48ee-a639-252eb0e6dfb5

📥 Commits

Reviewing files that changed from the base of the PR and between 7c2d03f and fa727f6.

📒 Files selected for processing (3)
  • ci/lint_cpp_rs/src/checkers/bare_legacy.rs
  • ci/lint_cpp_rs/src/lint_core/processor_registry_cli.rs
  • ci/lint_cpp_rs/src/lint_core/tests.rs

📝 Walkthrough

Walkthrough

The shared C++ lint scanner now removes comments while preserving visible code and quoted literals. Five legacy checkers use the scanner before matching. Regression tests cover multiline comments, strings, and suppressions.

Changes

Block comment linting

Layer / File(s) Summary
Comment and literal scanner
ci/lint_cpp_rs/src/lint_core/processor_registry_cli.rs
The scanner handles block comments, line comments, quoted literals, escapes, and digit-separator quotes while preserving visible code.
Checker comment processing
ci/lint_cpp_rs/src/checkers/bare_legacy.rs
The legacy checkers strip block comments before filtering comments and suppressions. The obsolete helper was removed.
Regression coverage
ci/lint_cpp_rs/src/lint_core/tests.rs
Tests verify reporting of visible code around comments and ignoring commented content, string literals, and suppressions.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SourceLine
  participant strip_block_comments_from_line
  participant LegacyChecker
  SourceLine->>strip_block_comments_from_line: provide source line and comment state
  strip_block_comments_from_line-->>LegacyChecker: return visible code
  LegacyChecker->>LegacyChecker: filter comments and suppressions
  LegacyChecker-->>SourceLine: report matching visible code
Loading
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/3946-block-comment-lints

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 fix/3946-block-comment-lints branch August 20, 2026 21:24
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.

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

1 participant