docs(exit_codes): note that --no-raise must precede the subcommand#1955
Open
bearomorphism wants to merge 1 commit intocommitizen-tools:masterfrom
Open
docs(exit_codes): note that --no-raise must precede the subcommand#1955bearomorphism wants to merge 1 commit intocommitizen-tools:masterfrom
bearomorphism wants to merge 1 commit intocommitizen-tools:masterfrom
Conversation
`--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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a placement warning for
--no-raise/-nrindocs/exit_codes.md.--no-raiseis 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):All existing examples in
docs/exit_codes.mdalready 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?
Generated-by: GitHub Copilot