Skip to content

docs(exit_codes): note that --no-raise must precede the subcommand#1955

Open
bearomorphism wants to merge 1 commit intocommitizen-tools:masterfrom
bearomorphism:docs/no-raise-placement
Open

docs(exit_codes): note that --no-raise must precede the subcommand#1955
bearomorphism wants to merge 1 commit intocommitizen-tools:masterfrom
bearomorphism:docs/no-raise-placement

Conversation

@bearomorphism
Copy link
Copy Markdown
Collaborator

Description

Adds a placement warning for --no-raise / -nr in docs/exit_codes.md.

--no-raise is registered on the top-level parser (commitizen/cli.py:100-106), so it must appear before the subcommand. Placing it after falls into the unknown-args validator and exits with code 18 (InvalidCommandArgumentError):

Invalid commitizen arguments were found: --no-raise. Please use -- separator for extra git args

All existing examples in docs/exit_codes.md already use the correct placement, but the constraint is never stated explicitly. Two recent PRs got it wrong despite the docs being clear by example:

This PR adds a !!! warning "Flag placement" admonition immediately after the flag is introduced, so the rule is impossible to miss when readers skim that section.

Preview

!!! warning "Flag placement"
    `--no-raise` / `-nr` is a **top-level Commitizen flag**, so it must be passed
    **before** the subcommand:

    ```sh
    cz --no-raise 21 bump --yes        # ✅ correct
    cz -nr 21 bump --yes               # ✅ correct (short form)
    ```

    Placing it after the subcommand fails with exit code 18
    (`InvalidCommandArgumentError`):

    ```sh
    cz bump --yes --no-raise 21        # ❌ wrong
    # Invalid commitizen arguments were found: `--no-raise`.
    # Please use -- separator for extra git args
    ```

No code changes; documentation only.

Checklist

Was generative AI tooling used to co-author this PR?

  • Yes (please specify the tool below)

Generated-by: GitHub Copilot

`--no-raise` / `-nr` is registered on the top-level parser, so it
must appear before the subcommand (e.g. `cz -nr 21 bump`). Placing it
after the subcommand falls into the unknown-args validator in
`commitizen/cli.py` and exits with code 18
(`InvalidCommandArgumentError`) and the message:

    Invalid commitizen arguments were found: `--no-raise`.
    Please use -- separator for extra git args

All existing examples in `docs/exit_codes.md` already follow the
correct placement, but the constraint is never stated explicitly. Two
recent PRs (commitizen commitizen-tools#1950 and setup-cz commitizen-tools#17) got it wrong despite the
docs being clear by example, breaking the bump workflow. Add an
admonition right after the flag introduction so the rule is impossible
to miss.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant