Repository navigation
fix(dead_code): control keywords need '(' and return needs a statement end in C-family - #8255
Merged
Merged
Conversation
…divider false positives Same /**(?!\*) and (?<!/)///(?!/) guard #8200 put on c/cpp: apex, dart, groovy, java, javascript, kotlin, objective-c, php, scala, solidity, swift, typescript, yacc. A /***** box border or //// divider is not a doc block. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ount (?!\*) also rejected Magento-style '/***' docblocks (found on the golden: Mysql.php's doc count went up as their @var tags counted alone). Reject only banner shapes: /**** (2+ extra stars) and one-line '/*** x ***/' boxes. Applied to all 15 /** languages, c/cpp included. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… doc blocks) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
#8240 was blessed before #8245 merged, so main's goldens never had both: with jcl's positional comments, 119 jcl steps now read Has Header Comment 0 -> 1. Plus this PR's own GLTFLoader.js banner drift. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t end in C-family
On curl 39 of 48 dead_code hits were prose: '/* for offsetof() */',
'/* if a request ... (on a file) */', '/* return the position after
%time{} */'. In c/cpp/java/javascript/typescript, if/for/while must be
followed by '(' (their conditions always are); in c/cpp/java a commented
return must end in ';' or return a call directly (#7207's
'// return foo(x)'). curl: 48 -> 9 hits, both real commented-out
statements kept, the rest are commented prototypes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n's stale jcl header drift) Co-Authored-By: Claude Opus 5.5 <[email protected]>
squid-protocol
marked this pull request as ready for review
November 11, 2026 01:41
Contributor
…x/dead-code-control-keyword-shape # Conflicts: # tests/golden_master_audit/12_scan_output_snapshots/gpu_json.json # tests/golden_master_zero_dep_audit/12_scan_output_snapshots/gpu_json.json
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-keyword-shape # Conflicts: # tests/golden_master_audit/12_scan_output_snapshots/gpu_json.json # tests/golden_master_zero_dep_audit/12_scan_output_snapshots/gpu_json.json
Owner
Author
Contributor
|
No description provided. |
Contributor
|
No description provided. |
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.
Summary
dead_code(commented-out code,state_graveyard) was mostly prose on real C. On curl (temporal-crucible#118, comment-extraction Wave A), 39 of its 48 hits were prose:#include <stddef.h> /* for offsetof() */include notes (33),/* if a "head"-like request is being made (on a file) */,/* return the position after %time{} */.The cause is the keyword arm of
commented_keyword_statement: "keyword, then anything, then a(...)group or{}at the end of the line" reads as statement-shaped.Fix. Two opt-in keyword classes in the shared helper:
paren_keywords: the keyword must be followed directly by(. Used forif|for|whilein c, cpp, java, javascript, typescript, whose conditions are always parenthesised. Go, Rust, Swift, Python etc. keep the current rule (if x {,if x:).semicolon_keywords: the line must end in;, or the keyword directly returns a call (dead_code (commented-out code) rules match English comments: COBOL's matched 21 of 21 prose lines; 43 of 57 language rules match plain-prose probes #7207's// return foo(x)). Used forreturnin c, cpp, java, where every statement ends in;. JavaScript/TypeScript keep the current rule (ASI).Measured
curl (pinned
04bfe8fbbf, C outside tests/docs): 48 -> 9 hits./* while(*p) */,/* j = ERR_R_ASN1_LIB; */./* int send(int, char *, int, int); */).Golden (language-crucible): three files move, and every dropped match is prose:
c/micropython/compile.c5 -> 2:// if both exist, the tuple is above ...,// return its name (the 'f' in "def f(...):").typescript/typescript_compiler/checker.ts91 -> 86:// if the parameter is used covariantly ...,// for error recovery purposes. ....cpp/godot/rendering_server_default.h1 -> 0://if editor is redrawing when it shouldn't, ....Downstream of those three, these move: Commented Logic Exposure, the directory averages, the hits/risks digests and the LLM brief. File-cluster distances move in the third decimal (
state_graveyardis a file-brain feature); no file changes archetype.Also in this bless: 68 jcl files'
Has Header Comment(0 -> 1). That is main's stale golden, not this PR. #8240 was blessed before #8245 merged, so main never had the two together. #8244 carries the same correction; whichever merges second re-blesses.Should the rule go?
No. It feeds a risk score (Commented Logic Exposure), cognitive load and the file archetype brain, and its recall on real commented-out code is fine. The failure was this one loose shape. temporal-crucible's COM-H3 stays on hold until a re-measure with this fix on main.
Verification
test_c_family_dead_code_shape_7207.pynow also pins the curl prose cases (negatives) and/* while(*p) */,/* j = ERR_R_ASN1_LIB; */(positives). The long-line ReDoS test passes.test_<lang>.py+_strict.pyand every test file that mentionsdead_code: 6,813 passed.keyword-rosetta/tools/verify_language.pyc, cpp, java, javascript, typescript: PASS.ruff_audit.py --ci: no new findings; format clean.golden-lock.sh python tests/tools/crucible_check.py --update --yes.Size
7 source/test files plus golden parts (over the 5-file guideline): the shared helper, its five callers and one test.
🤖 Generated with Claude Code