René's URL Explorer Experiment


Title: Fix and improve test: message_length_limit by ttw225 · Pull Request #1900 · commitizen-tools/commitizen · GitHub

Open Graph Title: Fix and improve test: message_length_limit by ttw225 · Pull Request #1900 · commitizen-tools/commitizen

X Title: Fix and improve test: message_length_limit by ttw225 · Pull Request #1900 · commitizen-tools/commitizen

Description: Description This PR fixes how message_length_limit is resolved when the CLI flag is unset. Previously, the CLI argument could be present as None, causing arguments.get("message_length_limit", ...) to return None and skip the config fallback—so the configured limit (e.g. in pyproject.toml) was effectively ignored. - self.max_msg_length = arguments.get( - "message_length_limit", config.settings.get("message_length_limit", 0) + + message_length_limit = arguments.get("message_length_limit") + self.message_length_limit: int = ( + message_length_limit + if message_length_limit is not None + else config.settings["message_length_limit"] ) Now the precedence is correctly enforced as CLI > config > default (0 = no limit) for both cz commit and cz check, and additional unit + integration tests are added to prevent regressions. unit tests: test_commit_command.py, test_check_command.py integration tests: tests/test_cli_config_integration.py Checklist I have read the contributing guidelines Was generative AI tooling used to co-author this PR? Yes (please specify the tool below) Generated-with: [Cursor] following the guidelines Code Changes Add test cases to all the changes you introduce Run uv run poe all locally to ensure this change passes linter check and tests Manually test the changes: Verify the feature/bug fix works as expected in real-world scenarios Test edge cases and error conditions Ensure backward compatibility is maintained Document any manual testing steps performed Update the documentation for the changes Expected Behavior When message_length_limit is configured, cz commit / cz check should enforce it unless explicitly overridden via -l/--message-length-limit (including -l 0 to disable the limit). Steps to Test This Pull Request Steps to reproduce the behavior: Create a temp repo with a pyproject.toml containing: [tool.commitizen] name = "cz_conventional_commits" message_length_limit = 10 Confirm config is enforced (should fail): cz check --message "feat: this is definitely too long" Confirm CLI overrides config (should succeed): cz check -l 0 --message "feat: this is definitely too long" Additional Context #1899

Open Graph Description: Description This PR fixes how message_length_limit is resolved when the CLI flag is unset. Previously, the CLI argument could be present as None, causing arguments.get("message_length_limit&q...

X Description: Description This PR fixes how message_length_limit is resolved when the CLI flag is unset. Previously, the CLI argument could be present as None, causing arguments.get("message_length_lim...

Opengraph URL: https://github.com/commitizen-tools/commitizen/pull/1900

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:f081b0e3-c117-b513-1477-408e5ebfa3cb
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id903C:C3948:10210D1:1686ADB:6A4E97F6
html-safe-nonce1c53516f400440b5b1c2ef9549710ba4cc58ab1488e8a1c35d660168b4681a7f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MDNDOkMzOTQ4OjEwMjEwRDE6MTY4NkFEQjo2QTRFOTdGNiIsInZpc2l0b3JfaWQiOiI3MzQ4Mjk4MzkxMDY2MTExOTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmace9e1bd98b0c78b6a68e3b2838fabd2c61041a94d85792198f78b3365748a2653
hovercard-subject-tagpull_request:3413670369
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/commitizen-tools/commitizen/pull/1900/files
twitter:imagehttps://avatars.githubusercontent.com/u/35064951?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/35064951?s=400&v=4
og:image:altDescription This PR fixes how message_length_limit is resolved when the CLI flag is unset. Previously, the CLI argument could be present as None, causing arguments.get("message_length_limit&q...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/commitizen-tools/commitizen git https://github.com/commitizen-tools/commitizen.git
octolytics-dimension-user_id62252524
octolytics-dimension-user_logincommitizen-tools
octolytics-dimension-repository_id106127589
octolytics-dimension-repository_nwocommitizen-tools/commitizen
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id106127589
octolytics-dimension-repository_network_root_nwocommitizen-tools/commitizen
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee6a744804e8e70f97b4d5a18a94dcc63db22f97a
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/commitizen-tools/commitizen/pull/1900/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcommitizen-tools%2Fcommitizen%2Fpull%2F1900%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcommitizen-tools%2Fcommitizen%2Fpull%2F1900%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=commitizen-tools%2Fcommitizen
Reloadhttps://github.com/commitizen-tools/commitizen/pull/1900/files
Reloadhttps://github.com/commitizen-tools/commitizen/pull/1900/files
Reloadhttps://github.com/commitizen-tools/commitizen/pull/1900/files
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1900/files
commitizen-tools https://github.com/commitizen-tools
commitizenhttps://github.com/commitizen-tools/commitizen
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1900/files
Notifications https://github.com/login?return_to=%2Fcommitizen-tools%2Fcommitizen
Fork 344 https://github.com/login?return_to=%2Fcommitizen-tools%2Fcommitizen
Star 3.5k https://github.com/login?return_to=%2Fcommitizen-tools%2Fcommitizen
Code https://github.com/commitizen-tools/commitizen
Issues 116 https://github.com/commitizen-tools/commitizen/issues
Pull requests 45 https://github.com/commitizen-tools/commitizen/pulls
Discussions https://github.com/commitizen-tools/commitizen/discussions
Actions https://github.com/commitizen-tools/commitizen/actions
Projects https://github.com/commitizen-tools/commitizen/projects
Security and quality 0 https://github.com/commitizen-tools/commitizen/security
Insights https://github.com/commitizen-tools/commitizen/pulse
Code https://github.com/commitizen-tools/commitizen
Issues https://github.com/commitizen-tools/commitizen/issues
Pull requests https://github.com/commitizen-tools/commitizen/pulls
Discussions https://github.com/commitizen-tools/commitizen/discussions
Actions https://github.com/commitizen-tools/commitizen/actions
Projects https://github.com/commitizen-tools/commitizen/projects
Security and quality https://github.com/commitizen-tools/commitizen/security
Insights https://github.com/commitizen-tools/commitizen/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fcommitizen-tools%2Fcommitizen%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fcommitizen-tools%2Fcommitizen%2Fissues%2Fnew%2Fchoose
ttw225https://github.com/ttw225
commitizen-tools:masterhttps://github.com/commitizen-tools/commitizen/tree/master
ttw225:fix-and-test/message_length_limithttps://github.com/ttw225/commitizen/tree/fix-and-test/message_length_limit
Conversation 2 https://github.com/commitizen-tools/commitizen/pull/1900
Commits 7 https://github.com/commitizen-tools/commitizen/pull/1900/commits
Checks 20 https://github.com/commitizen-tools/commitizen/pull/1900/checks
Files changed https://github.com/commitizen-tools/commitizen/pull/1900/files
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1900/files
Fix and improve test: message_length_limit https://github.com/commitizen-tools/commitizen/pull/1900/files#top
Show all changes 7 commits https://github.com/commitizen-tools/commitizen/pull/1900/files
092ec64 fix(commit): honor message length limit from cli and config ttw225 Mar 18, 2026 https://github.com/commitizen-tools/commitizen/pull/1900/commits/092ec64e004e20b58d0318e9e83afd52b9a42f4f
2be6bcb fix(check): honor message length limit from cli and config ttw225 Mar 18, 2026 https://github.com/commitizen-tools/commitizen/pull/1900/commits/2be6bcb93de598b23dda71242e49abd8b36efb5e
6d7bba1 test(commit): add coverage for message length limit precedence ttw225 Mar 18, 2026 https://github.com/commitizen-tools/commitizen/pull/1900/commits/6d7bba1cf77dc3e762642e5e4d1547d7f948b5e8
b0deaf6 test(check): add coverage for message length limit precedence ttw225 Mar 18, 2026 https://github.com/commitizen-tools/commitizen/pull/1900/commits/b0deaf64afa0ff87054b56dbd847f17f2fe88cce
e61f70c test(cli-config): add integration tests for message length limit config ttw225 Mar 18, 2026 https://github.com/commitizen-tools/commitizen/pull/1900/commits/e61f70cca2006d26a6d3bf26eb35e437a314f96c
e6e7475 fix(types): allow None for message_length_limit cli arg ttw225 Mar 18, 2026 https://github.com/commitizen-tools/commitizen/pull/1900/commits/e6e74751f222dfe01ff3174ea4f29e28e9ee68f9
f5c4b48 refactor(test): apply type-check-only imports ttw225 Mar 18, 2026 https://github.com/commitizen-tools/commitizen/pull/1900/commits/f5c4b4880bd3204d75ee1ba702d784bcf16c0624
Clear filters https://github.com/commitizen-tools/commitizen/pull/1900/files
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1900/files
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1900/files
check.py https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-f2009c94d59b697e08241dfc746bd98bd9b47072ba948b2c7bab01fba887b453
commit.py https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-b682eb395fc382939bf1e227cb02ffd1a9335e1ee404b17702afaed226535c74
test_check_command.py https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-7b8c8b76ce1d42b29a8318f7447acfcaf7565dd871c3427bfaf69f70f700b836
test_commit_command.py https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-5bdfd11ecf3f34f6417cd6fc41228373fe0267ebe044bd202b061d111a6f980f
test_cli_config_integration.py https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-3373d2a64e01f294dbf366f734070b33d1a9eaaa909d09a427fe0ee74070538e
commitizen/commands/check.pyhttps://github.com/commitizen-tools/commitizen/pull/1900/files#diff-f2009c94d59b697e08241dfc746bd98bd9b47072ba948b2c7bab01fba887b453
View file https://github.com/commitizen-tools/commitizen/blob/f5c4b4880bd3204d75ee1ba702d784bcf16c0624/commitizen/commands/check.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/commitizen-tools/commitizen/pull/1900/{{ revealButtonHref }}
https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-f2009c94d59b697e08241dfc746bd98bd9b47072ba948b2c7bab01fba887b453
https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-f2009c94d59b697e08241dfc746bd98bd9b47072ba948b2c7bab01fba887b453
https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-f2009c94d59b697e08241dfc746bd98bd9b47072ba948b2c7bab01fba887b453
https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-f2009c94d59b697e08241dfc746bd98bd9b47072ba948b2c7bab01fba887b453
https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-f2009c94d59b697e08241dfc746bd98bd9b47072ba948b2c7bab01fba887b453
commitizen/commands/commit.pyhttps://github.com/commitizen-tools/commitizen/pull/1900/files#diff-b682eb395fc382939bf1e227cb02ffd1a9335e1ee404b17702afaed226535c74
View file https://github.com/commitizen-tools/commitizen/blob/f5c4b4880bd3204d75ee1ba702d784bcf16c0624/commitizen/commands/commit.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/commitizen-tools/commitizen/pull/1900/{{ revealButtonHref }}
https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-b682eb395fc382939bf1e227cb02ffd1a9335e1ee404b17702afaed226535c74
https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-b682eb395fc382939bf1e227cb02ffd1a9335e1ee404b17702afaed226535c74
https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-b682eb395fc382939bf1e227cb02ffd1a9335e1ee404b17702afaed226535c74
https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-b682eb395fc382939bf1e227cb02ffd1a9335e1ee404b17702afaed226535c74
https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-b682eb395fc382939bf1e227cb02ffd1a9335e1ee404b17702afaed226535c74
tests/commands/test_check_command.pyhttps://github.com/commitizen-tools/commitizen/pull/1900/files#diff-7b8c8b76ce1d42b29a8318f7447acfcaf7565dd871c3427bfaf69f70f700b836
View file https://github.com/commitizen-tools/commitizen/blob/f5c4b4880bd3204d75ee1ba702d784bcf16c0624/tests/commands/test_check_command.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/commitizen-tools/commitizen/pull/1900/{{ revealButtonHref }}
https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-7b8c8b76ce1d42b29a8318f7447acfcaf7565dd871c3427bfaf69f70f700b836
https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-7b8c8b76ce1d42b29a8318f7447acfcaf7565dd871c3427bfaf69f70f700b836
https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-7b8c8b76ce1d42b29a8318f7447acfcaf7565dd871c3427bfaf69f70f700b836
tests/commands/test_commit_command.pyhttps://github.com/commitizen-tools/commitizen/pull/1900/files#diff-5bdfd11ecf3f34f6417cd6fc41228373fe0267ebe044bd202b061d111a6f980f
View file https://github.com/commitizen-tools/commitizen/blob/f5c4b4880bd3204d75ee1ba702d784bcf16c0624/tests/commands/test_commit_command.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/commitizen-tools/commitizen/pull/1900/{{ revealButtonHref }}
https://github.com/commitizen-tools/commitizen/pull/1900/files#diff-5bdfd11ecf3f34f6417cd6fc41228373fe0267ebe044bd202b061d111a6f980f
tests/test_cli_config_integration.pyhttps://github.com/commitizen-tools/commitizen/pull/1900/files#diff-3373d2a64e01f294dbf366f734070b33d1a9eaaa909d09a427fe0ee74070538e
View file https://github.com/commitizen-tools/commitizen/blob/f5c4b4880bd3204d75ee1ba702d784bcf16c0624/tests/test_cli_config_integration.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/commitizen-tools/commitizen/pull/1900/{{ revealButtonHref }}
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1900/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.