Commit c49eb31
committed
chore: validate commit scope in commit-msg hook
cog verify in cocogitto 6.x does not validate the scope component of
a conventional commit header against the configured `scopes` list
(cocogitto/cocogitto#516). Fixed upstream in v7.0.0 by
cocogitto/cocogitto#541, but mmdflux can't move to v7 yet because of
the open cocogitto/cocogitto#558 monorepo bump_order regression.
Add an inline shell check to [git_hooks.commit-msg] that extracts the
scope from the header (handling the optional breaking-change `!`
marker) and rejects anything not in the cog.toml scopes list.
Single-line `scopes = [...]` parsing via awk; multi-line arrays would
need a real TOML parser. Unscoped commits (root crate, per the
project convention) continue to pass through.
This avoids the round-trip cost of pushing a commit with an
unrecognized scope and only finding out in CI. The block is tagged
with the upstream issue references so the next person knows to drop
it once both upstream changes are shippable.
Contributors re-running `just setup-hooks` from the main repo will
pick up the new hook automatically.1 parent ff52c16 commit c49eb31
1 file changed
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
53 | 73 | | |
54 | 74 | | |
55 | 75 | | |
| |||
0 commit comments