Skip to content

feat(code-tidying): extensible source classifier for audit-dead-code - #5481

Open
kyle-sexton wants to merge 5 commits into
mainfrom
feat/5329-extensible-source-classifier
Open

kyle-sexton wants to merge 5 commits into
mainfrom
feat/5329-extensible-source-classifier

Conversation

@kyle-sexton

Copy link
Copy Markdown
Contributor

Closes #5329

Summary

audit-dead-code classified source files from a closed extension list, so an unreferenced .sol, .s or extensionless script was never reported as unreferenced-file and did not count in Summary coverage.

Fix

  • dc_lang_of_path reads extensions from one list, DC_NOLANE_EXTS (.s, .asm, .sol added), 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.
  • The grep lane counts files with no symbol lane as covered, since it checks them for references.
  • SKILL.md documents how to extend the list.
  • code-tidying 0.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, .s and 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

kyle-sexton and others added 4 commits September 29, 2026 18:19
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>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton
kyle-sexton marked this pull request as ready for review September 29, 2026 22:31
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T22:34:58.968940Z ff5c9d3 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

@claude

claude Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +91 to +94
for word in ${words[@]+"${words[@]}"}; do
interp="${word##*/}"
[[ "$interp" == env || "$word" == -* || "$word" == *=* ]] || break
done

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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[@]}"}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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

claude Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

@claude

claude Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

audit-dead-code: extensible source classifier for unlisted extensions and extensionless scripts

1 participant