From 575711e5dcc414d90e8664301394b9605b0f3be5 Mon Sep 17 00:00:00 2001 From: Xianpeng Shen <3353385+shenxianpeng@users.noreply.github.com> Date: Sun, 18 Oct 2026 21:52:27 +0000 Subject: [PATCH] docs: bring guides, rules and examples in step with commit-check 2.19.2 --- docs/compare/tools.md | 2 +- docs/configuration.md | 23 ++++++++++++-------- docs/example.md | 15 +++++++------ docs/getting-started.md | 4 ++-- docs/guides/github-actions.md | 40 ++++++++++++++++++++++++++++------- docs/guides/github-app.md | 18 ++++++++++------ docs/guides/organization.md | 6 +++--- docs/guides/policies.md | 2 +- docs/guides/pre-commit.md | 6 +++--- docs/index.md | 4 ++-- docs/migration.md | 5 ++--- docs/rules.md | 21 +++++++++--------- docs/troubleshoot.md | 8 +++---- tests/docs_sync_test.py | 17 ++++++--------- 14 files changed, 101 insertions(+), 70 deletions(-) diff --git a/docs/compare/tools.md b/docs/compare/tools.md index e9fb82a..1b0f820 100644 --- a/docs/compare/tools.md +++ b/docs/compare/tools.md @@ -16,7 +16,7 @@ for the current state. GitHub's own rulesets are on | [commitcheck](https://github.com/marketplace/commitcheck) | A hosted App that applies one regular expression, set in its web admin | Commit message, pull request title or description, by regex | GitHub App | Free for public repositories; $25 a month for private ones | | [DCO app](https://github.com/apps/dco) and [DCO-2](https://github.com/cncf/dco2) | The sign-off check the Linux kernel and the CNCF use, with a remediation flow for missing sign-offs | `Signed-off-by` trailers | GitHub App | Free, open source | | [PRLint](https://github.com/ewolfe/prlint), [PR Title Checker](https://github.com/marketplace/actions/pr-title-checker) | Regular expressions over pull request fields | Title, body, labels, branch | App / Action | Free, open source | -| **Commit Check** | One rule engine, [documented rule by rule](../rules.md), run as a hook, a CLI, an Action, a hosted App or an MCP tool | Commit message, branch name, author name and email, sign-off, AI attribution, force pushes, file size and paths, tag names; the squash message of a pull request | All of the above | Free, open source; the App's private organization repositories move to a paid plan later | +| **Commit Check** | One rule engine, [documented rule by rule](../rules.md), run as a hook, a CLI, an Action, a hosted App or an MCP tool | Commit message, branch name, author name and email, sign-off, AI attribution, force pushes, file size and paths, tag names; the pull request title (Action) and the squash message of a pull request (App) | All of the above | Free, open source; the App's private organization repositories move to a paid plan later | ## What is different about Commit Check diff --git a/docs/configuration.md b/docs/configuration.md index 4fe674c..b104683 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -23,6 +23,7 @@ flag overrides both for a single run. | `--message` | Conventional Commits ([CC001](rules.md#cc001)), subject lengths of 5–80 characters ([CC004](rules.md#cc004), [CC005](rules.md#cc005)), and an allow-list of ten commit types | | `--branch` | Conventional Branch ([CC201](rules.md#cc201)) and an allow-list of twenty-one branch types | | `--author-name` / `--author-email` | The built-in name and email patterns ([CC101](rules.md#cc101), [CC102](rules.md#cc102)) | + | `--tag` | SemVer tag names, with an optional leading `v` ([CC401](rules.md#cc401)) | Off until you turn them on: subject capitalization, imperative mood, required body and signoff, and rebase requirements. @@ -89,8 +90,9 @@ It is a warning, not an error: the exit code and the JSON on stdout do not change. The top-level `warn` list and the GitHub App's [`[jira]`](guides/github-app.md#jira-ticket-references) and [`[pull_request]`](#pull-requests-every-commit-or-the-squash-message) sections -are read elsewhere and are not reported. The Python API and the MCP server -load the file themselves and do not report it either. +are read elsewhere and are not reported. The Python API reads no file at all +(it takes a `config` dict), and the MCP server loads the file itself without +reporting unknown settings. ## Inheriting a shared config @@ -115,12 +117,15 @@ The value can be a GitHub shorthand, a local path or an HTTPS URL: | Local file | `../../shared/org-cchk.toml` | | HTTPS URL | `https://example.com/shared/cchk.toml` | -!!! note "Inheritance fails quietly" +!!! note "Inheritance fails open" If the target is unreachable or the format is not recognized, Commit Check - ignores the inheritance and uses the local configuration alone. Plain HTTP - URLs are rejected outright. A repository that silently stops inheriting - still passes its own checks, so pin the branch when the policy matters. + ignores the inheritance and uses the local configuration alone, printing a + one-line `⊘ inherit_from ... could not be loaded` notice on stderr; the exit + code does not change. Plain HTTP URLs are rejected the same way. Only one + level is followed: an `inherit_from` inside the parent is ignored, with a + notice. A repository that stops inheriting still passes its own checks, so + pin the branch when the policy matters. ## Pull requests: every commit, or the squash message @@ -269,7 +274,7 @@ Used from a hook definition, with no config file anywhere in the repository: ```yaml title=".pre-commit-config.yaml" repos: - repo: https://github.com/commit-check/commit-check - rev: v2.19.1 + rev: v2.19.2 hooks: - id: check-message args: @@ -309,8 +314,8 @@ The full mapping between the three forms: | `require_body = false` | `CCHK_REQUIRE_BODY=false` | `--require-body=false` | | `require_signed_off_by = false` | `CCHK_REQUIRE_SIGNED_OFF_BY=false` | `--require-signed-off-by=false` | | `ignore_authors = ["bot"]` | `CCHK_IGNORE_AUTHORS=bot,user` | `--ignore-authors=bot,user` | -| `author_email_pattern=^.+@example\.com$` | `CCHK_AUTHOR_EMAIL_PATTERN=^.+@example\.com$` | `--author-email-pattern=^.+@example\.com$` | -| `author_name_pattern=^.+ .+$` | `CCHK_AUTHOR_NAME_PATTERN=^.+ .+$` | `--author-name-pattern=^.+ .+$` | +| `author_email_pattern = '^.+@example\.com$'` | `CCHK_AUTHOR_EMAIL_PATTERN=^.+@example\.com$` | `--author-email-pattern=^.+@example\.com$` | +| `author_name_pattern = '^.+ .+$'` | `CCHK_AUTHOR_NAME_PATTERN=^.+ .+$` | `--author-name-pattern=^.+ .+$` | | `conventional_branch = true` | `CCHK_CONVENTIONAL_BRANCH=true` | `--conventional-branch=true` | | `allow_branch_types = ["feature"]` | `CCHK_ALLOW_BRANCH_TYPES=feature,bugfix` | `--allow-branch-types=feature,bugfix` | | `allow_branch_names = ["staging", "production"]` | `CCHK_ALLOW_BRANCH_NAMES=staging,production` | `--allow-branch-names=staging,production` | diff --git a/docs/example.md b/docs/example.md index 5f59cf4..f9b535c 100644 --- a/docs/example.md +++ b/docs/example.md @@ -14,7 +14,7 @@ revision. === "From the repository" - Validates `HEAD`'s message. This is what the `commit-msg` hook runs. + Validates `HEAD`'s message. ```console $ commit-check -m @@ -22,6 +22,9 @@ revision. === "From a file" + This is what the `check-message` pre-commit hook runs, with the message + file git hands it. + ```console $ commit-check -m commit_message.txt ``` @@ -54,7 +57,7 @@ revision. ```console $ echo "updated the parser" | commit-check -m CC001 message check failed ==> updated the parser -The commit message should follow Conventional Commits. +The commit message should follow Conventional Commits. See https://www.conventionalcommits.org Suggest: Use (): , where is one of: feat, fix, ... Docs: https://commit-check.com/rules/#cc001 ``` @@ -109,8 +112,8 @@ $ commit-check --branch ``` Runs [CC201](rules.md#cc201), and [CC202](rules.md#cc202) if -`require_rebase_target` is set. `master`, `main`, `HEAD` and `PR-*` are always -accepted; everything else needs a `/` shape: +`require_rebase_target` is set. `main`, `master`, `develop`, `HEAD` and `PR-*` are +always accepted; everything else needs a `/` shape: ```text fix/empty-config-crash @@ -159,7 +162,7 @@ pushed: ```yaml title=".pre-commit-config.yaml" repos: - repo: https://github.com/commit-check/commit-check - rev: v2.19.1 + rev: v2.19.2 hooks: - id: check-no-force-push stages: [pre-push] @@ -198,7 +201,7 @@ and how CLI, environment and file settings override each other. ```console $ commit-check -m --compact - [FAIL] CC003 subject_imperative: docs: revamped the profile + [FAIL] CC003 subject-imperative: docs: revamped the profile ``` === "No banner" diff --git a/docs/getting-started.md b/docs/getting-started.md index 7053eb4..d21b8e2 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -77,7 +77,7 @@ Four things are happening in that output, and each is deliberate: ## 3. Fix it ```console -$ git commit --amend -m "fix(parser): handle empty input" +$ git commit --amend --allow-empty -m "fix(parser): handle empty input" $ commit-check --message ``` @@ -93,7 +93,7 @@ $ commit-check --branch ```text CC201 branch check failed ==> my-changes The branch should follow Conventional Branch. See https://conventionalbranch.org -Suggest: Use / with allowed types +Suggest: Use / with an allowed type, or add the branch to allow_branch_names in config Docs: https://commit-check.com/rules/#cc201 ``` diff --git a/docs/guides/github-actions.md b/docs/guides/github-actions.md index b687e5b..82f037e 100644 --- a/docs/guides/github-actions.md +++ b/docs/guides/github-actions.md @@ -31,12 +31,36 @@ jobs: author-email: true ``` -1. Commit Check needs the full history to inspect every commit in the pull - request. Without this it only sees the most recent one. +1. Recommended, not required: the Action then reads the pull request's + commits from the clone. With a shallow clone it lists them through the + GitHub API instead (up to 250), and if it cannot, it warns and checks the + head commit alone. The Action reads the same `cchk.toml` as the CLI, so a repository that already has one needs no Action-specific configuration. +## Inputs + +| Input | Default | What it does | +|---|---|---| +| `message` | `true` | Check every commit message of the pull request | +| `branch` | `true` | Check the branch name | +| `author-name` | `false` | Check each commit's author name | +| `author-email` | `false` | Check each commit's author email | +| `pr-title` | `false` | Check the pull request title against Conventional Commits, the one that matters for squash merges. Pull request events only | +| `pr-comments` | `false` | Post the report as a pull request comment, edited in place on later runs | +| `job-summary` | `true` | Write the report to the job summary | +| `dry-run` | `false` | Report failures as warnings and always exit `0` | + +`pull_request` does not fire when a title is edited. With `pr-title: true`, +add `types: [opened, synchronize, reopened, edited]` to re-check a renamed pull +request. + +The Action also sets a `result` output: the check results as JSON, read with +`fromJSON(steps..outputs.result)`. Its `status` is `pass`, `warn`, `skip` +or `fail`, and each scope carries the same per-check fields as +`commit-check --format json`. + ## Making it a required check { #making-it-a-required-check } Until it is required, a failing Commit Check does not stop anyone from @@ -55,11 +79,10 @@ needs fixing directly on the PR: message: true branch: true pr-comments: ${{ github.event_name == 'pull_request' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ``` -This needs extra permissions on the job: +The Action posts with the workflow's own token, so no `GITHUB_TOKEN` needs to +be passed in. It does need extra permissions on the job: ```yaml permissions: @@ -85,9 +108,10 @@ Turn it off once the history is clean. A `pull_request` workflow triggered by a fork receives a **read-only** `GITHUB_TOKEN`, and `permissions: pull-requests: write` does not override that. -`pr-comments` will therefore fail to post on fork pull requests unless the -repository has *Send write tokens to workflows from pull requests* enabled under -**Settings → Actions → General**. +On such a run the Action skips the comment with a warning and says so in the +job summary; the check, the annotations and the summary still work. For +feedback on fork pull requests themselves, use the [GitHub App](github-app.md), +which is not bound by the workflow's token. !!! warning "Do not reach for `pull_request_target` casually" diff --git a/docs/guides/github-app.md b/docs/guides/github-app.md index 56191bd..0f0e7ac 100644 --- a/docs/guides/github-app.md +++ b/docs/guides/github-app.md @@ -30,13 +30,14 @@ with the defaults, advisory only (see [Without a config file](#without-a-config- ## What you get On every push to a branch and on every pull request, each commit gets a check -run named **Commit Check** on the Checks tab, in the commit's status and in the +run named **Commit Check** (a push of more than 50 commits has its newest 50 +checked, and the older ones get one neutral "not checked" result) on the Checks tab, in the commit's status and in the merge box. (Tag pushes and branch deletions carry nothing to check; commits by bots are skipped, and squash mode checks a pull request as one message — both [below](#bots-re-runs-and-commits-checked-twice).) The result reads the same way everywhere: -- a one-line verdict — `All 4 checks passed`, or `2 of 4 checks failed`; +- a one-line verdict — `All 4 checks passed`, or `Commit message and branch failed (2 of 4 checks)`; - for a failure, a table of what failed, the value that failed and the rule ID, linked to the [rule reference](../rules.md); - **How to fix**: the rule's own explanation and suggestion; @@ -94,8 +95,9 @@ push or pull request, in the same four places: `cchk.toml`, `commit-check.toml`, `.github/commit-check.toml`. Every option on the [configuration page](../configuration.md) that belongs to a rule the App runs applies, precedence included; the `[push]`, `[files]` and `[tag]` sections are -read but have nothing to act on here. Nothing is App-specific to set, apart -from the two sections below. +read but have nothing to act on here. Nothing is App-specific to set apart +from `[pull_request]` (above) and `[jira]` (below); the CLI and the Action ignore +them. [`inherit_from`](organization.md) works, and a `github:` target is fetched with the App's own credentials, so a shared config in a private `.github` repository @@ -113,7 +115,7 @@ rules. A repository with no config file **and** no shared one has not chosen its rules, so its result is **advisory**: failures are reported in full, but the check is neutral — titled, -say, `2 of 4 checks would fail (not enforced)` — and never blocks a merge. Below the +say, `Commit message and branch would fail (2 of 4 checks, not enforced)` — and never blocks a merge. Below the fixes the report says why, and gives the smallest file that turns enforcement on: @@ -205,8 +207,10 @@ reports the same rule IDs — it just costs you CI minutes instead. ## Privacy -The App fetches the commits under test and the configuration file, nothing -else, and stores nothing: no database, no copy of any message, author or +The App fetches the commits under test, the configuration file (the +repository's own or its account's shared one) and the repository metadata the +checks need, such as the squash-merge settings and the comparison with a rebase +target, and stores nothing: no database, no copy of any message, author or config. The [privacy page](../privacy.md) lists the permissions it asks for and what each one is used for. diff --git a/docs/guides/organization.md b/docs/guides/organization.md index 6e5c488..a981693 100644 --- a/docs/guides/organization.md +++ b/docs/guides/organization.md @@ -29,7 +29,7 @@ allow_branch_types = ["feature", "bugfix", "hotfix", "release", "chore"] Where the [GitHub App](github-app.md) is installed on the organization, that file is already in force: a repository with no `cchk.toml` of its own is checked against the organization's, including repositories created tomorrow, -and the check run's last line says so. The App reads the file with its own +and the check run's report says so in its last lines. The App reads the file with its own credentials, so the `.github` repository can be private. A personal account's `.github` repository does the same for that account's repositories. A repository that commits its own config uses that instead — to build on the shared one rather @@ -102,8 +102,8 @@ stderr and ignored. !!! warning "Inheritance fails open" If the parent config is unreachable — a network blip, a renamed file, a - private repository — Commit Check silently falls back to the local config - rather than failing the build. This keeps CI green during an outage, but it + private repository — Commit Check falls back to the local config, with a + one-line notice on stderr, rather than failing the build. This keeps CI green during an outage, but it also means a typo in `inherit_from` is easy to miss. Verify the merged result when you first set it up: diff --git a/docs/guides/policies.md b/docs/guides/policies.md index f1ecc09..a390787 100644 --- a/docs/guides/policies.md +++ b/docs/guides/policies.md @@ -62,7 +62,7 @@ $ git rebase --signoff main The DCO is a statement about who wrote the code, so it only means something if the identity is real. [CC101](../rules.md#cc101) and -[CC102](../rules.md#cc102) check the committer name and email, and are enabled +[CC102](../rules.md#cc102) check the author name and email, and are enabled by default when their check runs: ```console diff --git a/docs/guides/pre-commit.md b/docs/guides/pre-commit.md index 615f389..63be68e 100644 --- a/docs/guides/pre-commit.md +++ b/docs/guides/pre-commit.md @@ -8,7 +8,7 @@ Add Commit Check to `.pre-commit-config.yaml`: ```yaml title=".pre-commit-config.yaml" repos: - repo: https://github.com/commit-check/commit-check - rev: v2.19.1 + rev: v2.19.2 hooks: - id: check-message - id: check-branch @@ -68,7 +68,7 @@ Options can be passed as hook arguments, which keeps everything in one file: ```yaml title=".pre-commit-config.yaml" repos: - repo: https://github.com/commit-check/commit-check - rev: v2.19.1 + rev: v2.19.2 hooks: - id: check-message args: @@ -90,7 +90,7 @@ colon, and lets the commit through: ```yaml title=".pre-commit-config.yaml" repos: - repo: https://github.com/commit-check/commit-check - rev: v2.19.1 + rev: v2.19.2 hooks: - id: check-message args: [--fix] diff --git a/docs/index.md b/docs/index.md index 3dab274..11a6810 100644 --- a/docs/index.md +++ b/docs/index.md @@ -409,12 +409,12 @@ conventional_branch = true
  • A fix you can paste, whenever the correction is unambiguous.
  • - +

    $ echo "Fix: add streaming support" | commit-check -m

    1CC001 message check failed ==>

    2Fix: add streaming support

    -

    3The commit message should follow Conventional Commits.

    +

    3The commit message should follow Conventional Commits. See https://www.conventionalcommits.org

    4Suggest: Use "fix: add streaming support"

    Docs: https://commit-check.com/rules/#cc001

    diff --git a/docs/migration.md b/docs/migration.md index 1844005..355144a 100644 --- a/docs/migration.md +++ b/docs/migration.md @@ -178,9 +178,8 @@ $ commit-check --message --branch `commit-check.toml`, in the repository root or `.github/`. Any other name needs `--config`. -**TOML fails to parse.** Usually unquoted strings, `True` instead of `true`, or -a trailing comma in an array. Editors validate the file against the published -schema — see +**TOML fails to parse.** Usually unquoted strings, or `True` instead of `true`. +Editors validate the file against the published schema — see [where the config file lives](configuration.md#where-the-config-file-lives). **A rule does not behave as expected.** Check the option name and its default in diff --git a/docs/rules.md b/docs/rules.md index 429010d..35f746a 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -8,8 +8,8 @@ Rule IDs appear in commit-check's output and in `--format json` results: ```text CC003 subject-imperative check failed ==> docs: revamped the profile -Commit message should use imperative mood (e.g., 'fix bug' not 'fixed bug') -Suggest: Change the first verb to imperative form, e.g., 'fix' instead of 'fixed' +Commit message should use imperative mood (e.g., 'fix bug' not 'fixed bug', 'add feature' not 'adding feature') +Suggest: Change the first verb to imperative form, e.g., 'fix' instead of 'fixed'/'fixes'/'fixing' Docs: https://commit-check.com/rules/#cc003 ``` @@ -17,7 +17,7 @@ Docs: https://commit-check.com/rules/#cc003 explanation, suggestion, and documentation link: ```text -[FAIL] CC003 subject_imperative: docs: revamped the profile +[FAIL] CC003 subject-imperative: docs: revamped the profile ``` When the correction is mechanical, the suggestion names it instead of @@ -89,7 +89,7 @@ Run with `-m` / `--message`. | [CC009](#cc009) | `allow-fixup-commits` | Fixup commits are not allowed | `-m` | ⚪ Off | | [CC010](#cc010) | `allow-wip-commits` | WIP commits are not allowed | `-m` | ⚪ Off | | [CC011](#cc011) | `require-body` | Commit body is required | `-m` | ⚪ Off | -| [CC012](#cc012) | `require-signed-off-by` | Signed-off-by not found in latest commit | `-m` | ⚪ Off | +| [CC012](#cc012) | `require-signed-off-by` | Signed-off-by trailer not found in the latest commit | `-m` | ⚪ Off | | [CC013](#cc013) | `ai-attribution` | AI attribution policy violation | `-m` | ⚪ Off | | [CC014](#cc014) | `ai-disclosure` | AI assistance is not disclosed with an accepted trailer | `-m` | ⚪ Off | | [CC015](#cc015) | `ai-co-author` | An AI tool is credited as a co-author | `-m` | ⚪ Off | @@ -329,7 +329,7 @@ result of a hurried commit rather than a deliberate one. **Example** ```text -fix: bug +fix ``` Use instead: @@ -686,7 +686,7 @@ off by accepting it as a disclosure. ```text CC016 ai-signoff check failed ==> Signed-off-by: Claude An AI tool signed off the commit: Claude Code -Suggest: Remove the AI sign-off, then sign off yourself (git commit --signoff) +Suggest: Use "Assisted-by: Claude" in place of the AI sign-off, then sign off yourself (git commit --signoff) ``` **Options** @@ -713,7 +713,7 @@ matters for both code archaeology and compliance. **Example** ```bash -git config user.name ec2-user +git config user.name 12 ``` Use instead: @@ -729,9 +729,10 @@ git config --global user.name "Your Name" !!! note - The built-in pattern accepts any name made of letters, spaces, and - `, . ' -`, so plain account names such as `root` or `ubuntu` still - pass it — only names containing digits or other symbols are rejected. Set + The built-in pattern accepts a name that starts with a letter and goes on + with letters, digits, `_`, spaces and `, . ' -`, so account names such as + `root`, `ubuntu` or `ec2-user` still pass it; a name that starts with a + digit or holds other symbols (`@`, `/`, ...) is rejected. Set `author_name_pattern` if you need something stricter. ### author-email (CC102) { #cc102 } diff --git a/docs/troubleshoot.md b/docs/troubleshoot.md index 32c2aab..a4ede87 100644 --- a/docs/troubleshoot.md +++ b/docs/troubleshoot.md @@ -8,7 +8,7 @@ bypass is the second thing to reach for. The first is reading what failed: every diagnostic names the rule, quotes the value that failed it, and links to the page explaining it. -Take an author name check that rejects a one-character name: +Take an author name check that rejects a name starting with a digit: ```shell check committer name.....................................................Failed @@ -23,7 +23,7 @@ Suggest: git config user.name 'Your Name' Docs: https://commit-check.com/rules/#cc101 ``` -`12` is the value Git actually recorded as the author — usually a sign that +`12` is the configured `user.name` — usually a sign that `user.name` was never set on this machine, or was set by a script. The fix is the one the `Suggest:` line gives: @@ -44,7 +44,7 @@ SKIP=check-author-name git commit --amend --no-edit ``` The IDs are `check-message`, `check-branch`, `check-author-name`, -`check-author-email` and `check-no-force-push`. +`check-author-email`, `check-no-force-push`, `check-tag` and `check-files`. ### Skipping every hook @@ -73,7 +73,7 @@ their defaults already applied, even with no config file present: `--message` enforces Conventional Commits, the 5–80 character subject limits and an allow-list of ten commit types; `--branch` enforces Conventional Branch and an allow-list of twenty-one branch types; `--author-name` and `--author-email` -apply the built-in patterns. The *Default* column in the +apply the built-in patterns; `--tag` holds tag names to SemVer. The *Default* column in the [rules reference](rules.md#rule-index) shows every rule's starting state, and the [configuration page](configuration.md) spells the split out. diff --git a/tests/docs_sync_test.py b/tests/docs_sync_test.py index f85f897..ab6a313 100644 --- a/tests/docs_sync_test.py +++ b/tests/docs_sync_test.py @@ -32,7 +32,7 @@ def _read_doc(name: str) -> str: #: A pasted failure line, e.g. ``CC003 subject-imperative check failed ==> ...`` _SAMPLE_FAILURE = re.compile(r"(CC\d{3}) (\S+) check failed ==>") -#: A pasted ``--compact`` line, e.g. ``[FAIL] CC003 subject_imperative: ...``. +#: A pasted ``--compact`` line, e.g. ``[FAIL] CC003 subject-imperative: ...``. #: Indented, because these samples sit inside content tabs. _COMPACT_FAILURE = re.compile(r"^\s*\[FAIL\] (CC\d{3}) ([^:\s]+):", re.M) @@ -108,17 +108,12 @@ def test_sample_output_matches_what_the_tool_prints(self): def test_compact_sample_output_matches_what_the_tool_prints(self): """Pasted ``--compact`` output names rules the way that format does. - The two text formats spell a check differently: the default output - prints the kebab-case name, and ``--compact`` prints the config key. - A sample of one therefore cannot be validated against the other, and - the guard above only matches the default format — so the compact - samples were checked by nothing at all. That is the blind spot that - let a pre-2.13 sample sit unnoticed in the troubleshooting page. - - If the two formats are ever reconciled (see commit-check#528), this - is what will point at the samples that need rewriting. + ``--compact`` once printed the config key while the default output + printed the kebab-case name; both now print the kebab-case name. The + guard above only matches the default format, so without this one the + compact samples would be checked by nothing at all. """ - stale = _stale_samples(_COMPACT_FAILURE, "check", "--compact") + stale = _stale_samples(_COMPACT_FAILURE, "name", "--compact") assert not stale, ( "compact sample output is out of date:\n " + "\n ".join(stale) )