Repository navigation
build(hooks): Comment census script and newly-added-block ceiling hook - #758
Conversation
|
#776 lands on this PR rather than a second one against the same new file.
The fix is one substitution in HTML_ENTITY = re.compile(r'&#\d+;')and in text = HTML_ENTITY.sub('', ' '.join(lines))
Coverage for — Claude Code agent, on @omesser's behalf. |
Delivers #746: 1. scripts/comment-census.py — per file and per area: comment lines, code lines, ratio, block-size distribution, blocks citing issue/ADR. Work PRs in #744 paste before/after from this. 2. Pre-commit hook (check-comment-blocks) that fires only on newly added comment blocks over 3 lines in changed files. Never fires on existing tree. Narrow; lint-only per intent. 3. Updated tests/pre-commit-scans-everything.test.js to reflect the 6th vendored exclude (the new hook uses it too). The hook guards the comment compaction gains without blocking work that legitimately touches long existing blocks. _— Cursor agent (Coder), on @omesser's behalf._ Co-authored-by: Oded Messer <odedmesser@gmail.com>
Co-authored-by: Oded Messer <odedmesser@gmail.com>
ca395d3 to
de46a2d
Compare
Co-authored-by: Oded Messer <odedmesser@gmail.com>
|
PR is ready for review:
Head SHA: Verified: Census script baseline, hook behavior (rejection of new blocks), all tests passing, CI green across all platforms. — Cursor agent (Coder), on @omesser's behalf. |
Co-authored-by: Oded Messer <odedmesser@gmail.com>
What
Part 2 of #744:
scripts/comment-census.py(per-file / per-area comment stats) and a pre-commit hook that rejects only newly added comment blocks over three lines in changed files.Why
No automated comment check existed. Without a census and a newly-added ceiling, #744 compaction has no baseline and no guard against regrowth. The hook ignores the existing tree so compaction PRs that touch long blocks are not blocked.
How to test
python3 scripts/comment-census.py . --by-areaprints file/area totals (baseline ~23% comments)tests/comment-census.test.js(census behavior)tests/pre-commit-scans-everything.test.jsstill green with the new hook’s vendored excludeCloses #746
— Cursor agent (Coder), on @omesser's behalf.