feat(conventional_commits): add ability to overide settings from tool…
….commitizen.customize
Description
Adds ability to override settings using [tool.commitizen.customize] in the cz_conventional_commits
Checklist
- [x] I have read the contributing guidelines
Code Changes
- [x] Add test cases to all the changes you introduce
- [x] Run
poetry alllocally to ensure this change passes linter check and tests - [x] Manually test the changes:
- [x] Verify the feature/bug fix works as expected in real-world scenarios
- [x] Test edge cases and error conditions
- [x] Ensure backward compatibility is maintained
- [x] Document any manual testing steps performed
- [x] Update the documentation for the changes
Documentation Changes
- [x] Run
poetry doclocally to ensure the documentation pages renders correctly - [x] 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.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 98.26%. Comparing base (120d514) to head (80b550c).
:warning: Report is 807 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #1570 +/- ##
==========================================
+ Coverage 97.33% 98.26% +0.92%
==========================================
Files 42 58 +16
Lines 2104 2714 +610
==========================================
+ Hits 2048 2667 +619
+ Misses 56 47 -9
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 98.26% <100.00%> (+0.92%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
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.