Repository navigation
ruby/perl/php/lua dead_code: count a keyword-led comment only when it has a statement's shape (Part of #7207) - #7341
Merged
Conversation
…ent's shape (Part of #7207) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…/gitgalaxy into churn/7207-20261031T1911Z
… has a statement's shape (Part of #7207) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
|
No description provided. |
Contributor
This was referenced Oct 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #7207 (slice 5). Follows #7335 (merged), which added the
marker=/extra=helper args.commented_keyword_statement(..., marker=, extra=)now drives ruby, perl, php and luadead_code; a keyword-led comment counts only when the rest of the line has a statement's shape.#):(...),;{}, an assignment, a quote /@/$/:/[argument, or a baredef|class|module Name [< Super].# class names are capitalised,# puts the resultno longer count.#, line-anchored as before):;{},(...), an assignment, a sigil / quote argument, or a baresub|method|class|package Name.//,/*,#: the keyword alternatives need the shape (or$var, or a bareclass|namespace|function Name [extends ...]);echo|print|return|var_dumpneed;,(...), an assignment or a quote /$argument. A lone// ;,// }still counts but is now end-of-line anchored (the old\s*could span a newline).#///+$var <assign|->|[|(|;>still counts.;{},(...), an assignment, a trailingthen/do, a quote /{argument, barefunction name/return value. Behaviour change: a---doc line is no longer commented-out code ((?<!-)), consistent with the existing---@returncontract.test_script_dead_code_shape_7207.pygains positives and prose negatives for the four languages; the existing ruby/perl/php/lua strict suites pass unchanged.Known losses (bare statement indistinguishable from prose): ruby
# if x,# puts x; perl# print $xis kept but# say hellois not; lua# local x.Goldens
Re-blessed both legs via
golden-lock.sh crucible_check.py --update --yes.scope_check.py --base HEAD~1 --expect ruby,perl,php,lua: 781 differences, attributed lua 375, perl 139, php 126, plus 141 unattributed repo-wide rollup / per-file fields (the dead-code and commented-logic consumers and the fingerprint); no other language moved. Ruby has no pinned-corpus drift.Gates
Strict suites for ruby/perl/php/lua + new test: 855 pass.
pr_gates --fast9/9;--ratchets9 pass, 0 skipped. Goldens re-blessed again after merging main (#7335 landed mid-work).Class / Sibling gaps
Class:
dead_coderules matching a bare comment marker + keyword (prose false positives), #7207. Members done across slices: cobol, c/cpp/java, csharp/typescript/javascript/rust, go/kotlin/swift, python/shell (#7335), and now ruby, perl, php, lua.Remaining slices: none for this slice's four languages.
Sibling gaps: the other ~31 languages from the issue's probe list (abap, ada, apex, dart, fortran, groovy, haskell, matlab, rexx, tcl, powershell, objective-c, scala, ...) remain, same mechanism with their own markers.
Cross-repo: none.
Co-Authored-By: Claude Sonnet 5.5 [email protected]
🤖 Generated with Claude Code