alunduil / alunduil/blog.alunduil.com

Custom Vale rules are covered by a regression fixture

Ouverte
#522 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
enhancement
Langage dominant
Astro
Étoiles
1
Forks
1
Merge moyen
6 h 34 min
PR mergées (30 j)
118

Description

## Summary

The repo's custom Vale rules are hand-verified once at authoring time and never again. A fixture asserting each rule's expected hits would catch a regression when a pattern is edited.

## Motivation

`Custom.DateFormat` (#291) was validated against 18 cases — 5 it must flag, 13 near-misses it must not, including "The team may 3 times revisit that decision", "In June 2026", and a `simonwillison.net/2026/May/25/` URL. Several of those encode real reasoning about why the pattern is shaped the way it is: the `Month YYYY` cases are the reason the month alternation is spelled out twice rather than deduplicated.

None of that survived the PR. The corpus was a temp file, so the next person to edit the regex re-derives the constraints or silently breaks one.

`Custom.Spelling` has the same exposure, though its surface is a vendored dictionary rather than an authored pattern.

## Scope

- A fixture per custom rule holding lines that must flag and lines that must not.
- A runner asserting Vale reports exactly the expected hits — the "must not" half is the valuable half, and a plain Vale run can't express it.
- Wire into `.pre-commit-config.yaml` and therefore CI.

The fixture can't simply be linted by the existing `vale` hook: it contains intentional violations, so it would fail the blocking run. It needs a runner that inverts the assertion, and a path excluded from the normal hook.

## Acceptance criteria

- [ ] Editing a custom rule so it stops flagging a known-bad line fails the suite.
- [ ] Editing a custom rule so it starts flagging a known-good line fails the suite.
- [ ] `pre-commit run --all-files` passes on an unmodified tree.

## Additional context

This is the repo's first test infrastructure — there is currently no test directory, no `test` script in `package.json`, and no fixture precedent. `scripts/install-lychee.sh` plus the shellcheck/shfmt hooks are the closest existing pattern, so a shell runner under `scripts/` would fit the grain. Worth weighing that new machinery against a personal blog's two custom rules before building it.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.