Repository navigation
embedded_python/fsharp/groovy/scala dead_code: count a keyword-led comment only when it has a statement's shape (Part of #7207) - #7360
Merged
Conversation
…mment only when it has a statement's shape (Part of #7207) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…hape (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
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.
Part of #7207 (slice 8).
dead_codefor embedded_python, fsharp, groovy and scala counted a comment marker plus a bare keyword; it now counts one only when the rest of the line has a statement's shape, viacommented_keyword_statement(marker=/extra=), copying #7355 / #7359.Changes
embedded_python: same shape as python (#marker;(...), assignment, trailing:,import a.b [as c]).groovy:;{},(...), assignment, Gradleimplementation 'g:a:v'(also compile/api/testImplementation), bareclass Name [extends ..], dottedimport a.b.C.fsharp(///doc lines excluded):(...), assignment,if .. then,match .. with,printfn "...",let .. =,type|module Name [=],open Ns.Name.scala:;{},(...), assignment,val x: Type,def f: Type, bareclass|object|trait Name [extends ..],println "...", dottedimport a.b._. Block-comment openers now apply to every keyword, not just def/val/class/object, matching the sibling rules.test_script_dead_code_shape_7207.py: 8 positives and 8 prose negatives per language, plus the long-line ReDoS check.golden-lock.sh crucible_check.py --update --yes; both fixtures move only in the same nine files earlier slices touched (dead-logic / commented-logic exposure, fingerprint, centroid distance, snapshots), by a few bytes.Class / Sibling gaps
Class:
dead_coderules that match a comment marker plus a bare statement keyword, so English prose comments count as commented-out code (#7207). Done in slices 1-7 (cobol; c/cpp/java; csharp/typescript/javascript/rust; go/kotlin/swift; python/shell; ruby/perl/php/lua; abap/ada/apex/dart), here (embedded_python, fsharp, groovy, scala) and in #7359 (acs, crystal, db2_sql, easytrieve, still open when this was written).Sibling gaps (same mechanism, not in this PR; probe hits from the issue in brackets): assembly (3), fortran (9), haskell (2), livecode (3), matlab (3), objective-c (2), postgresql (3), powershell (3), rexx (3), solidity (1), tcl (3), yacc (8), zig (3), zscript (4). Each needs its own comment syntax and a test pair; the issue's Caveat applies (confirm with the language's own marker).
Remaining slices: two or three more of four languages each, same files (language modules, the shared test, a golden bless).
Cross-repo
No companion PRs. Golden overlap: #7359 also re-blesses the same fixture files and edits the same test file; whichever merges second needs
git merge origin/main, take main's goldens, re-bless.Gates
Shape test 233 passed;
pr_gates --fast9/9 pass (ruff 0.17.1 pinned); golden bless run in both legs viagolden-lock.sh.--ratchetsnot run here (the dead_code change touches only the golden masters, which were blessed directly).🤖 Generated with Claude Code