Skip to content

fix(auditor): parse comments with string literal awareness to elimina… - #25

Merged
mdalhagg merged 1 commit into
mainfrom
3.4.1
Oct 22, 2026
Merged

mdalhagg merged 1 commit into
mainfrom
3.4.1

Conversation

@mdalhagg

Copy link
Copy Markdown
Owner

detect_unused_code v3.4.1 🚀

🛠️ What's Fixed & Improved

  • String-Literal-Aware Comment Parsing (Zero False Positives):
    • Upgraded the dead comment detector in UnusedCodeAuditor to be fully string-literal aware.
    • The line scanner now accurately tracks single-line strings ('...', "..."), raw strings (r'...', r"..."), and multi-line triple-quoted strings ('''...''', """...""").
    • Comment delimiters (/*, */, //) contained inside string literals (such as trimmed.startsWith('/*') or CLI documentation strings like "test/mocks/*") are no longer erroneously treated as active block comments.
    • Completely eliminates false-positive detections of dead commented code blocks and false high-comment ratios in active Dart files.

🧪 Test Coverage & Quality

  • Added regression tests verifying string literal comment boundary separation.
  • Passed 100% test suite (26/26 tests).
  • 0 warnings on dart analyze --fatal-infos.

@mdalhagg
mdalhagg merged commit 3cec696 into main Oct 22, 2026
1 check passed
@mdalhagg

Copy link
Copy Markdown
Owner Author

Approved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant