René's URL Explorer Experiment


Title: fix(cz_customize): set commit_parser default that captures change_type by bearomorphism · Pull Request #1970 · commitizen-tools/commitizen · GitHub

Open Graph Title: fix(cz_customize): set commit_parser default that captures change_type by bearomorphism · Pull Request #1970 · commitizen-tools/commitizen

X Title: fix(cz_customize): set commit_parser default that captures change_type by bearomorphism · Pull Request #1970 · commitizen-tools/commitizen

Description: Description Closes #466. Why cz_customize lets users define their own commit schema via changelog_pattern, change_type_order, and change_type_map — all the ingredients for a grouped changelog. However, until now, running cz changelog with those settings produced a single flat bullet list with no ### Feat / ### Fix headings, making the feature effectively unusable without an extra, non-obvious step. The root cause is the commit_parser default inherited from BaseCommitizen. BaseCommitizen.commit_parser is r"(?P.*)" (commitizen/cz/base.py:58) — a catch-all with no change_type named group. The changelog generator in commitizen/changelog.py:195 calls msg.pop("change_type", None) to key commits into sections; without that group, every commit yields change_type = None and lands in an ungrouped bucket (changelog.py:198). A maintainer confirmed the gap in December 2021 (issue comment by @woile): "I think the commit_parser regex is not exposed in the customize… and it looks like the customize is using the default from the base." Users who stumbled across the fix documented it in later comments — e.g. a community workaround posted in 2025 showing the exact four-group regex that had to be copy-pasted into every cz_customize config. Triage against master (v4.15.1) in #1964 verified the bug is still present: cz changelog --dry-run with changelog_pattern set still produces an ungrouped list. The fix gives CustomizeCommitsCz its own commit_parser class attribute — a conventional-commits-shaped default that works for any schema following the [(scope)][!]: convention — so users who only set changelog_pattern get grouping for free. What changed File Change commitizen/cz/customize/customize.py Added commit_parser class attribute (conventional-commits-shaped default with change_type, scope, breaking, and message named groups) tests/test_cz_customize.py Added test_commit_parser_default_extracts_change_type — regression test verifying all four named groups are extracted without any customize.commit_parser config key How it works The new class-level attribute (commitizen/cz/customize/customize.py:32–45 after the PR is applied) sits between the existing change_type_order default and __init__. It is a four-group regex: commit_parser = ( r"^(?P\w+)" r"(?:\((?P[^()\r\n]*)\))?" r"(?P!)?:\s*(?P.*)$" ) The __init__ override loop (commitizen/cz/customize/customize.py:40–50) already iterates over "commit_parser" and calls setattr if the user provided their own value. The class-level default is therefore transparently superseded by any customize.commit_parser key — zero behaviour change for existing configs that already set one. Why \w+ instead of a fixed alternation? cz_customize is format-agnostic: it cannot know which types a project has defined. Hard-coding feat|fix|chore|… would silently drop commits whose types aren't in the list. \w+ captures any single-token type, which matches every conventional-commits derivative. An alternative — deriving the alternation from changelog_pattern at runtime — was considered but is fragile: changelog_pattern is a broad filter regex, not a structured grammar, so parsing it reliably would require a regex-of-regexes approach. Why not just document "set commit_parser yourself"? The three other customisable attributes (changelog_pattern, change_type_order, change_type_map) all have sensible inherited defaults; a user who sets only those reasonably expects changelog grouping to work. generate_tree_from_commits (commitizen/changelog.py:92–171) compiles commit_parser with re.MULTILINE and calls map_pat.match(commit.message) per commit. process_commit_message (changelog.py:174–198) then calls parsed.groupdict() — so the named groups flow directly into the changes dict that drives section headings. Backward compatibility Users who already set customize.commit_parser explicitly are unaffected — the __init__ loop (customize.py:40–50) overwrites the class default with their value via setattr. Users who rely on the old flat-list behaviour (i.e., intentionally omitted commit_parser knowing it would match everything to None) will now see headings. This is the desired fix; the old behaviour was a bug, not a feature. All 66 existing test_cz_customize.py tests still pass — the new default only changes what happens when no commit_parser is configured. BaseCommitizen.commit_parser (commitizen/cz/base.py:58) is unchanged; other built-in cz_* plugins are unaffected. Checklist I have read the contributing guidelines Was generative AI tooling used to co-author this PR? Yes (please specify the tool below) Generated-by: Claude 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 (see "Steps to Test" below) Update the documentation for the changes Expected Behavior Scenario Outcome cz_customize with changelog_pattern + change_type_order, no commit_parser key cz changelog --dry-run renders ### feat, ### fix, ### chore headings cz_customize with an explicit customize.commit_parser That custom regex is used unchanged — default is never applied Any other built-in cz_* (e.g. cz_conventional_commits) Unaffected; BaseCommitizen.commit_parser is unchanged cz_customize with commits that don't match the new default (e.g. ticket-123 do stuff) Commits still appear under change_type = None — same as before; changelog_pattern controls what's included Steps to Test This Pull Request git fetch fork fix/466-cz-customize-commit-parser-default git checkout fork/fix/466-cz-customize-commit-parser-default # 1. Targeted regression test. uv run pytest tests/test_cz_customize.py::test_commit_parser_default_extracts_change_type -v # 2. Reproduce the bug, then verify the fix. mkdir /tmp/cz466 && cd /tmp/cz466 git init -b main git config user.name test && git config user.email test@test.com cat > .cz.yaml << 'EOF' commitizen: name: cz_customize version: 0.1.0 customize: schema_pattern: '(feat|fix|chore)(\(\S+\))?!?:(\s.*)' changelog_pattern: '^(feat|fix|chore)(\(.+\))?(!)?' change_type_order: ["BREAKING CHANGE", "feat", "fix", "chore"] EOF git add .cz.yaml git commit -m "chore: initial" git commit --allow-empty -m "feat(DL-4567): new feature test" git commit --allow-empty -m "fix(DL-1234): qweqwe" git commit --allow-empty -m "chore: update deps" # Before the fix: flat list, no headings. # After the fix: grouped by ### feat / ### fix / ### chore. cz changelog --dry-run

Open Graph Description: Description Closes #466. Why cz_customize lets users define their own commit schema via changelog_pattern, change_type_order, and change_type_map — all the ingredients for a grouped changelog. Howe...

X Description: Description Closes #466. Why cz_customize lets users define their own commit schema via changelog_pattern, change_type_order, and change_type_map — all the ingredients for a grouped changelog. Howe...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:e917636c-0a3b-42df-9356-de0a671066ed
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA968:2C37E4:BFB13:117860:6A4DFAAC
html-safe-nonce577ead7dd5520847f2662c284d7faa582ba105745d5c8a298a616995a5cd5d3a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTY4OjJDMzdFNDpCRkIxMzoxMTc4NjA6NkE0REZBQUMiLCJ2aXNpdG9yX2lkIjoiNjk4OTExMDQzMTg0ODQ2MzAyMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac580861dd66c36bce91df49503557fef6376280e10574a23141703201c867beab
hovercard-subject-tagpull_request:3654705873
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/1970/files
twitter:imagehttps://avatars.githubusercontent.com/u/26526132?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/26526132?s=400&v=4
og:image:altDescription Closes #466. Why cz_customize lets users define their own commit schema via changelog_pattern, change_type_order, and change_type_map — all the ingredients for a grouped changelog. Howe...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None5818716c93c6a2925b815402541a32814e43a7b1261c322b0c2df75224289566
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
release4314b1df11fa8a565684f3a72dc971e3785da365
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/commitizen-tools/commitizen/pull/1970/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcommitizen-tools%2Fcommitizen%2Fpull%2F1970%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/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/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/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%2F1970%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/1970/files
Reloadhttps://github.com/commitizen-tools/commitizen/pull/1970/files
Reloadhttps://github.com/commitizen-tools/commitizen/pull/1970/files
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1970/files
commitizen-tools https://github.com/commitizen-tools
commitizenhttps://github.com/commitizen-tools/commitizen
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1970/files
Notifications https://github.com/login?return_to=%2Fcommitizen-tools%2Fcommitizen
Fork 343 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
bearomorphismhttps://github.com/bearomorphism
commitizen-tools:masterhttps://github.com/commitizen-tools/commitizen/tree/master
bearomorphism:fix/466-cz-customize-commit-parser-defaulthttps://github.com/bearomorphism/commitizen/tree/fix/466-cz-customize-commit-parser-default
Conversation 6 https://github.com/commitizen-tools/commitizen/pull/1970
Commits 2 https://github.com/commitizen-tools/commitizen/pull/1970/commits
Checks 20 https://github.com/commitizen-tools/commitizen/pull/1970/checks
Files changed https://github.com/commitizen-tools/commitizen/pull/1970/files
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1970/files
fix(cz_customize): set commit_parser default that captures change_type https://github.com/commitizen-tools/commitizen/pull/1970/files#top
Show all changes 2 commits https://github.com/commitizen-tools/commitizen/pull/1970/files
a0ef51d fix(cz_customize): default commit_parser extracts change_type bearomorphism May 9, 2026 https://github.com/commitizen-tools/commitizen/pull/1970/commits/a0ef51d6036346ee146806c99f5638951d701fa0
4b78268 fix(cz_customize): make default commit_parser non-dropping bearomorphism May 9, 2026 https://github.com/commitizen-tools/commitizen/pull/1970/commits/4b782681c9c34ae21c335c5d0372776c3ad08657
Clear filters https://github.com/commitizen-tools/commitizen/pull/1970/files
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1970/files
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1970/files
customize.py https://github.com/commitizen-tools/commitizen/pull/1970/files#diff-9902f7d08f081f8ccb8e4acb71ad8e74dfb11df78618580dc8323c3386517aa4
test_cz_customize.py https://github.com/commitizen-tools/commitizen/pull/1970/files#diff-f5ec5ad6526890a0807a07554a2e54509c6e151065e880125006cb4518281732
commitizen/cz/customize/customize.pyhttps://github.com/commitizen-tools/commitizen/pull/1970/files#diff-9902f7d08f081f8ccb8e4acb71ad8e74dfb11df78618580dc8323c3386517aa4
View file https://github.com/commitizen-tools/commitizen/blob/4b782681c9c34ae21c335c5d0372776c3ad08657/commitizen/cz/customize/customize.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/commitizen-tools/commitizen/pull/1970/{{ revealButtonHref }}
https://github.com/commitizen-tools/commitizen/pull/1970/files#diff-9902f7d08f081f8ccb8e4acb71ad8e74dfb11df78618580dc8323c3386517aa4
https://github.com/commitizen-tools/commitizen/pull/1970/files#diff-9902f7d08f081f8ccb8e4acb71ad8e74dfb11df78618580dc8323c3386517aa4
tests/test_cz_customize.pyhttps://github.com/commitizen-tools/commitizen/pull/1970/files#diff-f5ec5ad6526890a0807a07554a2e54509c6e151065e880125006cb4518281732
View file https://github.com/commitizen-tools/commitizen/blob/4b782681c9c34ae21c335c5d0372776c3ad08657/tests/test_cz_customize.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/commitizen-tools/commitizen/pull/1970/{{ revealButtonHref }}
https://github.com/commitizen-tools/commitizen/pull/1970/files#diff-f5ec5ad6526890a0807a07554a2e54509c6e151065e880125006cb4518281732
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1970/files
https://github.com/commitizen-tools/commitizen/pull/1970/files#diff-f5ec5ad6526890a0807a07554a2e54509c6e151065e880125006cb4518281732
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1970/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.