Skip to content

csharp/typescript/javascript/rust dead_code: count a keyword-led comment only when it has a statement's shape (Part of #7207) - #7319

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

squid-shepherd[bot] merged 3 commits into
mainfrom
churn/7207-20261031T1444Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #7207 (slice 2 of 3: csharp, typescript, javascript, rust).

What changed

The dead_code rule of csharp, typescript, javascript and rust now uses commented_keyword_statement (added in #7307) in place of the bare comment-marker + keyword alternative. A keyword-led comment counts only when the rest of the line has a statement's shape (ends in ; { } or a (...) group, or holds an assignment). JavaScript uses block=False (its rule was // only). New test tests/extraction/languages/test_web_systems_dead_code_shape_7207.py: per language, real commented-out statements match, prose from the issue's probe list does not, and a 15k-char line stays fast.

Golden drift (attributed)

Only typescript (vscode, 49 of the first 100 listed diffs) and rust (tokio) rows move, all in Commented-out Code (Dead Logic) and the commented-logic exposure derived from it, plus the fingerprint rounding that follows. Checked case: rust/tokio/tokio_named_pipe.rs 276 -> 0. All 276 old hits were /// rustdoc lines (/// use std::io;, /// if it is called with ...); the file has no // or /* comment led by a keyword. The (?<![/*]) guard in the helper excludes doc comments, as in slice 1. Full list is capped by crucible_check.py; I did not scope the remaining ~918 beyond the signal and the languages.

Class / Sibling gaps

Class: dead_code rules led by a bare keyword after a comment marker match English prose (#7207, 43 of 57 languages). Handled here: csharp, typescript, javascript, rust (same helper, same mechanism). Handled earlier: cobol (#7207 slice 1), c, cpp, java (#7307).
Sibling gaps (next slice and later; need a different mechanism or a different marker):

  • go, kotlin, swift, dart, scala, groovy, php, zscript, apex, solidity, zig, crystal, objective-c: // family; statement shape differs (semicolon-less in go/kotlin/swift/scala), so the helper's ;/{/(...)/= shapes need a per-language check. Slice 3 candidates.
  • python, ruby, shell, perl, lua, powershell, tcl, matlab, fortran, ada, abap, rexx, haskell, fsharp, yacc, assembly, db2_sql, postgresql, easytrieve, acs, livecode, embedded_python: other comment markers (#, --, !, %, ;, *); the helper is //-/* only, needs a marker parameter.

Remaining slices

Slice 3: go, kotlin, swift (then the // family above, then non-slash markers).

Gates

Unit test: 51 passed. pr_gates --fast: all pass after ruff format on csharp.py. pr_gates --ratchets: 9 pass, 0 fail, 0 skipped. Golden: blessed via golden-lock.sh crucible_check.py --update --yes (both legs).

Cross-repo: none.

🤖 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 15:03
@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) October 31, 2026 15:06
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@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