Skip to content

feat(conventional_commits): add ability to overide settings from tool… #1570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

AxTheB
Copy link

@AxTheB AxTheB commented Aug 7, 2025

….commitizen.customize

Description

Adds ability to override settings using [tool.commitizen.customize] in the cz_conventional_commits

Checklist

Code Changes

  • Add test cases to all the changes you introduce
  • Run poetry 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

Documentation Changes

  • Run poetry doc locally to ensure the documentation pages renders correctly
  • Check and fix any broken links (internal or external) in the documentation

Expected Behavior

You use conventional_commits commitizen, and using [tool.commitizen.customize] config section you override selected settings

Steps to Test This Pull Request

Add this to pyproject.tomp in existing project using conventional_commits and update_changelog_on_bump = true:

[tool.commitizen.customize]
change_type_map = {"feat" = "✨ Feat", "fix" = "🐛 Bug Fix", "refactor" = "♻️  Refactor", "perf" = "⚡️ Perf"}

do cz bump --dry-run and observe that changelog headers have gitmoji.
Test that other behavior is identical to unpatched version
test that
bump_map = {"^.+!$" = "MAJOR", "^feat" = "MAJOR", "^fix" = "MINOR", "^refactor" = "MINOR", "^perf" = "MINOR"} bumps MINOR not PATCH part on fix commit, test that other things are unchanged.
Test other settings.

Additional Context

This is starting shot at #1385
To test this I copied tests for cz_customize, removed name=... from all configs there and removed the tests that don't make
sense, for example exception for missing customize section.

Copy link

codecov bot commented Aug 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.98%. Comparing base (120d514) to head (3129cd6).
⚠️ Report is 755 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1570      +/-   ##
==========================================
+ Coverage   97.33%   97.98%   +0.64%     
==========================================
  Files          42       58      +16     
  Lines        2104     2723     +619     
==========================================
+ Hits         2048     2668     +620     
+ Misses         56       55       -1     
Flag Coverage Δ
unittests 97.98% <100.00%> (+0.64%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AxTheB
Copy link
Author

AxTheB commented Aug 7, 2025

I decided not to drag in the jinja2.Template/string.Template dichotomy, as jinja2 is project dependency so the string.Template part will be unused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant