Title: Fix: message_length_limit config is ignored when CLI flag is unset (commit/check) · Issue #1899 · commitizen-tools/commitizen · GitHub
Open Graph Title: Fix: message_length_limit config is ignored when CLI flag is unset (commit/check) · Issue #1899 · commitizen-tools/commitizen
X Title: Fix: message_length_limit config is ignored when CLI flag is unset (commit/check) · Issue #1899 · commitizen-tools/commitizen
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 bu...
Open Graph 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. ...
X 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. ...
Opengraph URL: https://github.com/commitizen-tools/commitizen/issues/1899
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fix: message_length_limit config is ignored when CLI flag is unset (commit/check)","articleBody":"### Description\n\nWhen `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`.\nCurrently, 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.\n\nReason why:\n1. `argparse` leaves `message_length_limit` as `None` when the flag isn’t provided (no default is set). eg. `cz commit`\n3. Because **the key still exists in arguments**, `arguments.get(\"message_length_limit\", ...)` returns `None` and never falls back to `config.settings`, effectively **bypassing the configured limit**.\n\n### Steps to reproduce\n\n1. Create a `pyproject.toml` with:\n```toml\n[tool.commitizen]\nname = \"cz_conventional_commits\"\nmessage_length_limit = 10\n```\n\n2. Run either:\n- `cz check --message \"feat: this is definitely too long\"`\n- or `cz commit --dry-run` and enter a subject that makes the first line longer than 10 characters.\n\n3. Ensure you did **not** pass -l/--message-length-limit.\n\n### Current behavior\n\nThe configured `message_length_limit` from `pyproject.toml` is **not enforced** when the CLI flag is unset, allowing too-long subjects to pass.\n\n### Desired behavior\n\n- Enforce `message_length_limit` from config when `-l/--message-length-limit` is not provided.\n- Precedence should be CLI \u003e config \u003e default (0 = no limit).\n- `-l 0` should explicitly disable the limit even if config sets one.\n\n### Screenshots\n\n\u003cimg width=\"922\" height=\"695\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/34f7643b-a782-4f44-9704-ba9bd610be34\" /\u003e\n\n### Environment\n\nCommitizen Version: 4.13.9\nPython Version: 3.14.3 (main, Feb 3 2026, 15:32:20) [Clang 15.0.0 (clang-1500.1.0.2.5)]\nOperating System: Darwin","author":{"url":"https://github.com/ttw225","@type":"Person","name":"ttw225"},"datePublished":"2026-03-18T08:49:25.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1899/commitizen/issues/1899"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a733d920-a612-7ebd-c225-4154f71e56df |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CE1E:2A5AF:6DC2D:9294A:6A4EA978 |
| html-safe-nonce | f6a3e6b2344b32701056f1d082b5f9817aa0ff40e3795d0a11175f2041df64c3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTFFOjJBNUFGOjZEQzJEOjkyOTRBOjZBNEVBOTc4IiwidmlzaXRvcl9pZCI6IjcyNzg5OTA2MDgwMTc4MjgyMTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c52ac06a400da6e60fcb11d73d89a47bc9aadf94d16196cfd043dc647e2285d1 |
| hovercard-subject-tag | issue:4093670220 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/commitizen-tools/commitizen/1899/issue_layout |
| twitter:image | https://opengraph.githubassets.com/309f7985d328c3a927b34364ed626fa8728b57f062018fa461775974691d6f1c/commitizen-tools/commitizen/issues/1899 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/309f7985d328c3a927b34364ed626fa8728b57f062018fa461775974691d6f1c/commitizen-tools/commitizen/issues/1899 |
| og:image:alt | 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. ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ttw225 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c |
| turbo-cache-control | no-preview |
| go-import | github.com/commitizen-tools/commitizen git https://github.com/commitizen-tools/commitizen.git |
| octolytics-dimension-user_id | 62252524 |
| octolytics-dimension-user_login | commitizen-tools |
| octolytics-dimension-repository_id | 106127589 |
| octolytics-dimension-repository_nwo | commitizen-tools/commitizen |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 106127589 |
| octolytics-dimension-repository_network_root_nwo | commitizen-tools/commitizen |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6a744804e8e70f97b4d5a18a94dcc63db22f97a |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width