Repository navigation
csharp/typescript/javascript/rust dead_code: count a keyword-led comment only when it has a statement's shape (Part of #7207) - #7319
Merged
Conversation
…ent only when it has a statement's shape (Part of #7207) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…#7207) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
|
No description provided. |
Contributor
|
No description provided. |
Contributor
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 2 of 3: csharp, typescript, javascript, rust).
What changed
The
dead_coderule of csharp, typescript, javascript and rust now usescommented_keyword_statement(added in #7307) in place of the barecomment-marker + keywordalternative. 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 usesblock=False(its rule was//only). New testtests/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.rs276 -> 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 bycrucible_check.py; I did not scope the remaining ~918 beyond the signal and the languages.Class / Sibling gaps
Class:
dead_coderules 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):
//family; statement shape differs (semicolon-less in go/kotlin/swift/scala), so the helper's;/{/(...)/=shapes need a per-language check. Slice 3 candidates.#,--,!,%,;,*); 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 afterruff formaton csharp.py.pr_gates --ratchets: 9 pass, 0 fail, 0 skipped. Golden: blessed viagolden-lock.sh crucible_check.py --update --yes(both legs).Cross-repo: none.
🤖 Generated with Claude Code