Conversation
Treat an omitted CLI option as no override so project configuration controls body wrapping while an explicit zero continues to disable it. Fixes commitizen-tools#2093 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2094 +/- ##
=======================================
Coverage 98.27% 98.27%
=======================================
Files 61 61
Lines 2836 2838 +2
=======================================
+ Hits 2787 2789 +2
Misses 49 49 ☔ View full report in Codecov by Harness. |
schlotter
marked this pull request as ready for review
September 23, 2026 08:22
This branch has not been deployed
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
Make
cz commithonorbody_length_limitfrom project configuration when--body-length-limitis omitted.The argument parser supplies
Nonefor an omitted option. That value previouslymasked the configured limit because
dict.get()only used its default when thekey was absent. The command now treats
Noneas no CLI override while retainingthe existing behavior where an explicit
--body-length-limit 0disableswrapping.
Fixes #2093.
Checklist
Was generative AI tooling used to co-author this PR?
Generated-by: GitHub Copilot CLI following the guidelines
Code Changes
uv run poe alllocally to ensure this change passes linter check and teststhe hook-integration tests attempted to install Prettier; npm and node
rejected the local TLS issuer. Ruff, mypy, and all 35 commit-command tests
pass.
configuration and CLI semantics are unchanged
Documentation Changes
Not applicable.
uv run poe doclocally to ensure the documentation pages renders correctlyExpected Behavior
cz commitwraps body lines at the configuredbody_length_limitwhen no CLIoverride is provided. Passing
--body-length-limit 0still disables wrapping.Steps to Test This Pull Request
body_length_limit = 20.cz commitwithout--body-length-limitand enter a body line longerthan 20 characters.
--body-length-limit 0and verify that wrapping is disabled.uv run pytest tests/commands/test_commit_command.py.Additional Context
The regression test exercises the same
Nonevalue produced by argparse whenthe CLI option is omitted. Collected coverage remains 98% overall and 99% for
commitizen/commands/commit.py; all newly added executable lines are covered.