Skip to content

Enforce the comment standards at build time - #24

Merged
miridius merged 1 commit into
mainfrom
review-standards-tooling
Jul 24, 2026
Merged

Enforce the comment standards at build time#24
miridius merged 1 commit into
mainfrom
review-standards-tooling

Conversation

@miridius

Copy link
Copy Markdown
Owner

Problem

The review pipeline kept catching the same mechanical classes of finding, comment-style violations and stray en/em dashes, at review time, where each catch costs a full review round. The standards the reviewers enforce were not visible to whoever writes the code, and nothing checked for the banned characters before review.

Fix

Two build-time mechanisms:

  • .claude/rules/comments.md: the comment standards as an auto-loading rules file scoped to src/**, test/**, and scripts/**, so anyone editing those files gets the standards injected up front instead of learning them from a review finding.
  • scripts/check-dashes.sh: scans the staged .ts files (the exact content a commit records) for literal en/em dashes and fails the commit if any are found. Run by check.sh (so the pre-commit hook enforces it) and mirrored in CI for pushes that bypass the local hook.

The gate keys on the index, not the worktree: a staged dash blocks the commit even if the worktree copy is clean, and an unstaged-only dash does not block. A scan that cannot run (missing PCRE, bad invocation) exits non-zero rather than passing silently.

Deliberate trade-offs: the gate covers .ts files only, matching where the comment standards apply (dashes in Markdown, shell, and YAML prose stay legal), and fixtures that need the real character use the \u2013/\u2014 escapes, an intentional bypass for payload fidelity.

@miridius
miridius force-pushed the review-standards-tooling branch 2 times, most recently from 2195de0 to 587306a Compare July 24, 2026 19:00
New .claude/rules/comments.md auto-loads the review comment standards for
anyone editing src, test, or scripts (naming the concrete defect classes:
narrating the obvious, restating tests, change justification, redundant
contrast; a file's existing density is never a license). scripts/
check-dashes.sh gates en/em dashes out of every tracked .ts file, called
from both check.sh and CI (for pushes that bypass the local hook). The gate
scans the INDEX (git grep --cached: exactly what a commit records), pins
LC_ALL=C for byte-wise PCRE, and fails loud when the scan itself cannot run.
Failing at build time replaces a whole review round.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DL3md3a3RoeRNStaDv1PDf
@miridius
miridius force-pushed the review-standards-tooling branch from 587306a to 5eb831c Compare July 24, 2026 19:06
@miridius
miridius merged commit f90b47e into main Jul 24, 2026
3 checks passed
@miridius
miridius deleted the review-standards-tooling branch July 24, 2026 19:51
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.

1 participant