Repository navigation
yacc dead_code: count a keyword-led comment only when it has a statement's shape (Part of #7207) - #7407
Merged
Conversation
…ent's shape (Part of #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: yacc).
What
yacc.pydead_codenow usescommented_keyword_statement(same pattern as #7402): a//or/*comment led byif|for|while|return|%tokencounts only when the rest of the line has a statement's shape.%tokendeclarations have no;{}/(...), so anextrabranch accepts the directive followed by ALL-CAPS token names (optional<type>tag, optional number).// return value is ignored,// if the parse failsand// %token is declared hereno longer count.Test:
tests/extraction/languages/test_yacc_dead_code_shape_7207.py(12 positives, 9 prose negatives, a long-line ReDoS check).Golden drift
Re-blessed with
golden-lock.sh crucible_check.py --update --yeson top of main including #7402. One file moves in both fixtures:cobol/gnucobol_internals/parser.yCommented Logic Exposure 4.81% -> 0.0% (its matches were prose); no other language moved.Class / Sibling gaps
Class:
dead_coderules that match a comment marker plus a bare keyword, so English comments match (#7207). This PR covers yacc, whose%tokenshape needed theextrabranch. Sibling gaps: the languages still on a bare-keyworddead_coderule are tracked in #7207's table; this PR does not change them. Other yacc-family rules (bison) share this definition. No new gaps found while here.Gates
pr_gates --fast9/9,--ratchets9 pass / 0 fail / 0 skipped;test_yacc*.pypass.Remaining slices
Whatever languages remain in the #7207 table after #7402 and this PR; each is one rule file plus a test.
🤖 Generated with Claude Code