Skip to content

Commit f38b381

Browse files
authored
docs: describe the fix field and the concrete suggestions (#32)
> **Held until the next commit-check release.** The `fix` field lives on commit-check `main` (commit-check/commit-check#564) and is not in the released 2.16.0 that this site pins. Merge this together with the release's version bump. ## What Follows commit-check/commit-check#564, which makes a failed check name its correction when the fix is unambiguous and carries it in a new `fix` field of the JSON output. - **Command-line recipes → Reading the JSON**: explains `fix`, shows a failed CC001 check with `suggest` and `fix` populated, and states when `fix` stays empty (a subject with no type, a length limit, a non-imperative verb). - **Rules reference**: next to the generic sample output, a sample where the suggestion names the correction (`Suggest: Use "fix: add x"`), taken verbatim from the tool. The MCP guide is unchanged: commit-check-mcp 0.1.9 does not pass `fix` through yet. That guide gets its paragraph when the server does. ## Notes - Sample outputs are the tool's real output and pass the docs-sync tests (9 passed). - No changelog entry: the changelog is written per release. - Netlify deploy preview builds.
1 parent ce718c7 commit f38b381

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

‎docs/example.md‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,3 +276,30 @@ CC001
276276
Each failed check carries the rule ID, the offending value, the suggestion and
277277
a link to its documentation — the same information the text output prints, in a
278278
form other tools can consume.
279+
280+
When the correction is mechanical — a type written `Fix` where `fix` is
281+
allowed, a letter out of place, a missing colon, a `WIP:` marker, a missing
282+
`Signed-off-by` trailer, a branch typed `Feature/x` — the check also carries
283+
the corrected value in `fix`, and `suggest` names it:
284+
285+
```console
286+
$ echo "Fix: add streaming support" | commit-check -m --format json | jq '.checks[0]'
287+
```
288+
289+
```json
290+
{
291+
"rule_id": "CC001",
292+
"check": "message",
293+
"status": "fail",
294+
"value": "Fix: add streaming support",
295+
"error": "The commit message should follow Conventional Commits. See https://www.conventionalcommits.org",
296+
"suggest": "Use \"fix: add streaming support\"",
297+
"fix": "fix: add streaming support",
298+
"docs_url": "https://commit-check.com/rules/#cc001"
299+
}
300+
```
301+
302+
`fix` is empty whenever the correction takes a judgment — a subject with no
303+
type at all, one over the length limit, a verb that is not imperative — and
304+
`suggest` then keeps the rule's general advice. A tool can apply a non-empty
305+
`fix` as it stands; a person only ever needs `suggest`.

‎docs/rules.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ explanation, suggestion, and documentation link:
2020
[FAIL] CC003 subject_imperative: docs: revamped the profile
2121
```
2222

23+
When the correction is mechanical, the suggestion names it instead of
24+
repeating the rule — and `--format json` carries the corrected value in a
25+
`fix` field (see [Reading the JSON](example.md#reading-the-json)):
26+
27+
```text
28+
CC001 message check failed ==> Fix: add x
29+
The commit message should follow Conventional Commits. See https://www.conventionalcommits.org
30+
Suggest: Use "fix: add x"
31+
Docs: https://commit-check.com/rules/#cc001
32+
```
33+
2334
## How to read this page
2435

2536
Rule IDs are grouped by what they inspect:

0 commit comments

Comments
 (0)