feat(code-tidying): extensible source classifier for audit-dead-code - #5481
kyle-sexton wants to merge 5 commits into
Conversation
Classify source files from one DC_NOLANE_EXTS list (adds .s, .asm, .sol) and classify extensionless files by their line-1 shebang: a shell interpreter joins the shell lane, any other interpreter is a source file with no lane. The grep lane now marks no-lane files covered, since it checks them for references. Refs #5329 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…source-classifier
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ff5c9d38c9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for word in ${words[@]+"${words[@]}"}; do | ||
| interp="${word##*/}" | ||
| [[ "$interp" == env || "$word" == -* || "$word" == *=* ]] || break | ||
| done |
There was a problem hiding this comment.
Parse env option arguments before classifying the interpreter
When a valid shebang uses an env option with a separate argument, such as #!/usr/bin/env -S -u PYTHONPATH bash or -C DIR, this loop skips -u/-C but mistakes the following argument for the interpreter and classifies the script as nolane. GNU env --help documents that -u and -C take arguments and that -S supports multi-argument shebangs. Consequently, a referenced shell script can bypass shell-symbol extraction, contain an unreferenced function, and still produce a clean result with covered=1; consume arguments for these options before selecting the interpreter.
Useful? React with 👍 / 👎.
| fi | ||
| emit_unreferenced_files | ||
| dc_account_lane_files ran ${DEF_FILES[@]+"${DEF_FILES[@]}"} | ||
| dc_account_lane_files ran ${DEF_FILES[@]+"${DEF_FILES[@]}"} ${NOLANE_FILES[@]+"${NOLANE_FILES[@]}"} |
There was a problem hiding this comment.
Avoid covering no-lane files that were never searched
When an extensionless non-shell script at the repository root has a one- or two-character name, such as py, both its basename and relative path are rejected by dc_ref_key_ok's three-character minimum, so emit_unreferenced_files creates no search key for it. This new unconditional accounting still marks every NOLANE_FILES entry covered, causing the scan to report covered=1, zero candidates, and a clean-result note even though that file was never checked for references. Mark only no-lane files for which a searchable key was actually emitted, or leave the others uncovered.
Useful? React with 👍 / 👎.
… no-lane files Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
Closes #5329
Summary
audit-dead-codeclassified source files from a closed extension list, so an unreferenced.sol,.sor extensionless script was never reported asunreferenced-fileand did not count inSummary coverage.Fix
dc_lang_of_pathreads extensions from one list,DC_NOLANE_EXTS(.s,.asm,.soladded), and classifies an extensionless file by its line-1 shebang: a shell interpreter joins the shell lane, another interpreter is a source file with no lane, no shebang is not source.code-tidying0.24.0 to 0.25.0 with a CHANGELOG entry.Verification
bash plugins/code-tidying/skills/audit-dead-code/scripts/dead-code-scan.test.sh: All 274 checks passed (covers unreferenced and referenced.sol,.sand shebang scripts, and coverage counts).scripts/check-changelog-parity.sh --check --check-order: passed.scripts/validate-plugins.sh: all manifests and the catalog validated.Related
🤖 Generated with Claude Code