Repository navigation
Conversation
Signed-off-by: lusoris <lusoris@proton.me>
The pre-push docstring check now reports every input it does not read
instead of dropping it. Raw path lists past MAX_RAW_PATHS count as not
checked, files past MAX_SOURCE_LINES return a file-too-large finding,
and a diff past MAX_HUNKS treats every function in the file as touched
rather than stopping at the cap.
Shell comment stripping only cuts at a hash that starts a word, so
`$#` and `${#x}` stay code. A git failure after the merge base resolves
names the failing git subcommand instead of the merge-base hint.
Tests cover the long-hunk, hunk-overflow, long-span and raw-path bounds
next to the earlier positive, negative and boundary cases.
Signed-off-by: lusoris <lusoris@proton.me>
…coverage Signed-off-by: lusoris <lusoris@proton.me>
…ture Adding docstring_coverage_policy_test.py to the required suite list in scripts/ci/python-tests.sh made python-tests-policy_test.sh fail: its fixture repositories had no stand-in for the new suite, so every runner call stopped at "required Python test is missing". Each fixture root now writes a passing stand-in for the suite, the required_suites list includes it, and the run-once check expects 13 suites instead of 12. Signed-off-by: lusoris <lusoris@proton.me>
…coverage Signed-off-by: lusoris <lusoris@proton.me>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 27 minutes. View limit details
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. |
Reviewer's GuideImplementationReview the bounded, branch-touched Python and shell docstring policy that the hook will execute.
ConfigurationReview the pre-push hook command that invokes the policy for pushed files.
TestsReview the policy tests, including the Git fixtures and cases that verify findings, bounds, line mapping, failures, and hook wiring.
Review registration of the new policy suite in the Python test runner and its policy-test fixtures.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
A lone carriage return inside a pushed Python or shell file made the docstring gate miss a touched function. Text mode turned the CR into a newline, and the Python parser breaks lines there too, while git numbers lines by LF only. The function then sat past every touched hunk line and passed without a docstring. Git output is now decoded from bytes. Shell lines and the size bound split on LF, Python node lines go through a map from parser lines to git lines, and hunk headers are read from LF-split diff text. Tests b20 to b24, n10 and n11 cover lone CR and CRLF content for both languages, a CR inside a diff line, an untouched function next to a lone CR, and the bound at and past its limit. Six mutants, one per change, each turn their test red. Signed-off-by: lusoris <lusoris@proton.me>
Pull Request
Summary
scripts/ci/docstring_coverage_policy.pyon the pushed Python and shell files. A function this branch touches with cyclomatic complexity 2 or more must carry a docstring, or a#comment block directly above it for shell. Before this, the CodeRabbit "Docstring Coverage" pre-merge warning was the first place a missing docstring showed up.origin/maincount, read from the committed blob, so legacy functions stay quiet until a branch edits them. Every bound reports what it skips: paths past the file limit are named as not checked, an oversized file is afile-too-largefinding, and a diff past the hunk limit counts every function in the file as touched.DocstringCoveragePolicyTesthas 29 cases: planted Python and shell findings, documented and simple functions, untouched and legacy code, deletions, nested functions and methods, committed blob versus worktree, Windows paths, the path, hunk, span and file bounds, parse and git failures, the lefthook wiring and a self-check over the policy itself. Nine mutants, one per bound or rule, each turn their test red.Type of change
Checklist
make cipasses locally (0 lint · 0 gosec · 0 govulncheck · race-green)AGENTS.mdfx.Moduleand have anfxtest.Newsmoke testdocs/adr/if this records an architecture decisiondocs/architecture/container.pumlupdated if a new top-level package landedREADME.mdmodule catalog +capabilities.yamlupdated (if a package was added or moved)AGENTS.mdlayout tree updated (if a new top-level package was added)Local gates:
make verify-allexited 0 on1efcfbacwith the pinned engine. The merge of main inc7bd50e0adds the 10 one-line persona Markdown insertions from #1586, and onc7bd50e0the pre-push hook passed all seven steps (audit, build-test, docstring-coverage, merge-comments, python-tests, security, shellcheck).End to end through lefthook 2.2.2 (
lefthook run pre-push --command docstring-coverage --file <path>, one scratch clone per scenario): a planted undocumented branching function exits 1, the same function with a docstring exits 0, and the planted file under a Windows-separator path next toREADME.mdexits 1. On the base commit the job does not exist, so the same planted function passes the push gate.Migration (breaking changes only)
References
exportedandpackage-commentsrules in.golangci.yml; C has no docstring check.Summary by Sourcery
Enforce branch-touched docstring coverage for complex Python and shell functions during pre-push checks.
New Features:
Enhancements:
CI:
Tests: