feat(githooks): canonical docstring scanner with a known-answer suite - #1073
Open
hyperpolymath wants to merge 1 commit into
Open
hyperpolymath wants to merge 1 commit into
hyperpolymath wants to merge 1 commit into
Conversation
Adds .githooks/docstring-scan.sh. It asks the same question as CodeRabbit's "Docstring Coverage" check: of the functions a change touches, how many carry a docstring? It answers per function with added/modified provenance, and in --check mode it blocks only on a newly-added undocumented function. The Stop hook, the pre-commit validator and the CI backstop all consume it. Tier 1 is shell. Every other source file reports as SKIPPED, never as documented, and the SUMMARY line always prints its denominator. scripts/tests/docstring-scan-test.sh (30 assertions) calibrates against PR #1034 at 1cc72cd (2 files / 13 functions / 0.00% / 3 skipped). If that commit is absent, the calibration fails rather than skipping. The suite also covers: - a planted positive and a negative control; - added vs modified; - predicate edges (trailing comment, shellcheck directive, heredoc body); - --staged/--worktree parity; - paths containing spaces or non-ASCII characters. These mutants were each killed: a shellcheck directive counted as a docstring, a heredoc body treated as code, untracked files dropped, a trailing comment counted as a docstring, and a deleted fixture docstring. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019aa9y32JcBuZ85KXe2jb8R
Contributor
|
Warning Review limit reachedNext included review available in 54 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
hyperpolymath
enabled auto-merge (squash)
September 30, 2026 10:19
This branch has not been deployed
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
Arm 0 of the docstring-coverage cure. Adds
.githooks/docstring-scan.sh, the estate's single docstring predicate, plus its fixture suitescripts/tests/docstring-scan-test.sh.--worktree(for the Stop hook),--staged(pre-commit) and--range BASE..HEAD(CI and calibration).--check: exits 1 only when a newly-added function has no docstring. An undocumented function that already existed and was only edited is reported but does not block.SUMMARYline that always prints the denominator.Why
CodeRabbit's "Docstring Coverage" warning keeps firing across the estate. Shell is the language it has been proven to parse, and the shell baseline is 0.00%. Two consumers still to come will both call this scanner: the Claude Stop hook and a
.githooksvalidator.Verification
bash scripts/tests/docstring-scan-test.shpasses 30/30.1cc72cdc80c9: 2 files, 13 functions, 0.00% coverage, 3 skipped.self-test.ymlalready checks out withfetch-depth: 0, so that commit is reachable in CI.🤖 Generated with Claude Code
https://claude.ai/code/session_019aa9y32JcBuZ85KXe2jb8R