Repository navigation
Commit 7315edf
authored
fix: print the display name in compact output, not the config key (#529)
* fix: print the display name in compact output, not the config key
The same failing check is named two ways depending on the format:
$ commit-check -m --subject-imperative=true --no-banner
CC003 subject-imperative check failed ==> docs: revamped the profile
$ commit-check -m --subject-imperative=true --compact
[FAIL] CC003 subject_imperative: docs: revamped the profile
Both are text written for a person, so they should agree. The kebab-case
form is the one that agrees with the rules reference, whose headings read
`subject-imperative (CC003)` — so a name printed to a terminal can be
searched for there verbatim, which is why the default output already
converts.
Every other human-facing surface in the ecosystem does the same:
commit-check-action converts the JSON `check` field before showing it in
step logs, job summaries and pull request comments. Compact was the only
one left printing the raw key.
The JSON output is deliberately unchanged. Its `check` field carries the
snake_case key so a consumer can map a failure back to the `cchk.toml`
option that controls it, which is what the action relies on.
Both call sites now go through one helper rather than one of them
open-coding the conversion, which is how they drifted apart to begin
with.
Refs #528
* refactor: keep one implementation of the check display name
Review pointed out that RuleCatalogEntry.name already did the same
snake-to-kebab conversion, so the helper added in the previous commit was
a second copy and its docstring claim that every text surface goes
through it was false. Two copies of the rule this change exists to
enforce is the wrong number.
The helper moves to rules_catalog rather than the catalog importing it
from util. rules_catalog is a pure data module — dataclasses and nothing
else — and commit-check-mcp imports it directly, so it should not gain a
dependency on a module that pulls in os, sys and subprocess. Pointing the
arrow the other way keeps the catalog light and puts the formatter beside
the entry whose name property defines the concept.
Verified there is now one implementation, that both call sites reach it,
and that importing util, rules_catalog, engine and main together raises
no cycle.1 parent 1072b87 commit 7315edf
3 files changed
Lines changed: 50 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
27 | 43 | | |
28 | 44 | | |
29 | 45 | | |
| |||
35 | 51 | | |
36 | 52 | | |
37 | 53 | | |
38 | | - | |
| 54 | + | |
39 | 55 | | |
40 | 56 | | |
41 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
| 27 | + | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
364 | 366 | | |
365 | 367 | | |
366 | 368 | | |
367 | | - | |
368 | | - | |
369 | | - | |
| 369 | + | |
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
728 | 728 | | |
729 | 729 | | |
730 | 730 | | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
731 | 760 | | |
732 | 761 | | |
733 | 762 | | |
| |||
0 commit comments