-
-
Notifications
You must be signed in to change notification settings - Fork 331
Open
Labels
Description
Description
When message_length_limit is configured (e.g., in pyproject.toml), cz commit / cz check should enforce it unless the user explicitly overrides it via the CLI -l/--message-length-limit.
Currently, if the CLI argument exists but is None/unset, the code path ends up treating it as “no limit”, so the configured limit is not applied.
Reason why:
argparseleavesmessage_length_limitasNonewhen the flag isn’t provided (no default is set). eg.cz commit- Because the key still exists in arguments,
arguments.get("message_length_limit", ...)returnsNoneand never falls back toconfig.settings, effectively bypassing the configured limit.
Steps to reproduce
- Create a
pyproject.tomlwith:
[tool.commitizen]
name = "cz_conventional_commits"
message_length_limit = 10- Run either:
cz check --message "feat: this is definitely too long"- or
cz commit --dry-runand enter a subject that makes the first line longer than 10 characters.
- Ensure you did not pass -l/--message-length-limit.
Current behavior
The configured message_length_limit from pyproject.toml is not enforced when the CLI flag is unset, allowing too-long subjects to pass.
Desired behavior
- Enforce
message_length_limitfrom config when-l/--message-length-limitis not provided. - Precedence should be CLI > config > default (0 = no limit).
-l 0should explicitly disable the limit even if config sets one.
Screenshots
Environment
Commitizen Version: 4.13.9
Python Version: 3.14.3 (main, Feb 3 2026, 15:32:20) [Clang 15.0.0 (clang-1500.1.0.2.5)]
Operating System: Darwin
Reactions are currently unavailable