Add large-file ratchet + duplicate-code guardrails (CI + pre-commit) - #174
Merged
important-new merged 1 commit intoJun 21, 2026
Merged
Conversation
Prevent the monoliths just split from growing back, and stop copy/paste from creeping in: - scripts/check-file-size.mjs + file-size-baseline.json: ratchet gate (limit 400 lines). New oversized files fail; the 43 grandfathered files are capped at their current size and may only shrink (--update tightens the ratchet). Excludes generated + tests. - jscpd (.jscpd.json, threshold 5%, current 4.2%): duplicate-code ceiling. - Wired both into npm run lint (CI) + the pre-commit hook, alongside the existing ds/migrefs scans. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014mPDZXfG1msCexx1sL7zyP
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.
Add large-file ratchet + duplicate-code guardrails
Prevents the monoliths just split (inspection.service / inspections / admin /
inspection-edit, etc.) from growing back, and stops copy/paste from creeping in —
enforced locally (pre-commit) and in CI (
npm run lint).Large-file ratchet —
scripts/check-file-size.mjs+file-size-baseline.jsongrandfathered in the baseline, capped at their current size, and may only
shrink (
--updatetightens the ratchet). Bumping the baseline is a deliberate,reviewed escape hatch — same philosophy as
db:check'sKNOWN_ACCEPTEDand thebundle-size cap.
Duplicate-code ceiling —
jscpd(.jscpd.json, threshold 5%)Wiring
Both are in
npm run lint(so CI'sverifyjob enforces them with no workflowchange) and added as steps in
.githooks/pre-commit. Verified: gates pass oncurrent code, catch a synthetic 401-line file (fail), and the commit's full
pre-commit (type-check + both gates + bundle) is green.
🤖 Generated with Claude Code