Skip to content

ruby/perl/php/lua dead_code: count a keyword-led comment only when it has a statement's shape (Part of #7207) - #7341

Merged
squid-shepherd[bot] merged 7 commits into
mainfrom
churn/7207-20261031T1911Z
Oct 31, 2026
Merged

squid-shepherd[bot] merged 7 commits into
mainfrom
churn/7207-20261031T1911Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

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 lua dead_code; a keyword-led comment counts only when the rest of the line has a statement's shape.

  • ruby (#): (...), ;{}, an assignment, a quote / @ / $ / : / [ argument, or a bare def|class|module Name [< Super]. # class names are capitalised, # puts the result no longer count.
  • perl (#, line-anchored as before): ;{}, (...), an assignment, a sigil / quote argument, or a bare sub|method|class|package Name.
  • php: //, /*, #: the keyword alternatives need the shape (or $var, or a bare class|namespace|function Name [extends ...]); echo|print|return|var_dump need ;, (...), 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.
  • lua: ;{}, (...), an assignment, a trailing then/do, a quote / { argument, bare function name / return value. Behaviour change: a --- doc line is no longer commented-out code ((?<!-)), consistent with the existing ---@return contract.
  • Tests: test_script_dead_code_shape_7207.py gains 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 $x is kept but # say hello is 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 --fast 9/9; --ratchets 9 pass, 0 skipped. Goldens re-blessed again after merging main (#7335 landed mid-work).

Class / Sibling gaps

Class: dead_code rules 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

@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 31, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review October 31, 2026 19:44
@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) October 31, 2026 19:45
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

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

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant