Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 304
feat(bump_rule): add BumpRule, VersionIncrement, Prerelease Enum#1431
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
feat(bump_rule): add BumpRule, VersionIncrement, Prerelease Enum #1431
Conversation
bearomorphism commented May 17, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
566e8ec to 03aa596Comparecodecovbot commented May 17, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@## refactors #1431 +/- ## ============================================= + Coverage 97.92% 97.97% +0.04% ============================================= Files 58 59 +1 Lines 2704 2770 +66 ============================================= + Hits 2648 2714 +66 Misses 56 56
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
4a0b84d to be7cb23Comparedeae807 to 88efb61CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
commitizen/bump_rule.py Outdated
| self._BREAKING_CHANGE, | ||
| "fix", | ||
| "feat", | ||
| "docs", | ||
| "style", | ||
| "refactor", | ||
| "perf", | ||
| "test", | ||
| "build", | ||
| "ci", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes the pattern matching more strict.
commitizen/cz/base.py Outdated
| # TODO: deprecate these | ||
| bump_pattern: str|None=None | ||
| bump_map: dict[str, str] |None=None | ||
| bump_map_major_version_zero: dict[str, str] |None=None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how to address these fields if we decide to check in the bump_rule change.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| ifnew_incrementisNone: | ||
| logger.debug( | ||
| f"no increment needed for '{found_keyword}' in '{message}'" | ||
| ) | ||
| ifVERSION_TYPES.index(increment) <VERSION_TYPES.index(new_increment): | ||
| logger.debug( | ||
| f"increment detected is '{new_increment}' due to '{found_keyword}' in '{message}'" | ||
| ) | ||
| increment=new_increment |
bearomorphismMay 17, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need these logs. The algorithm can be very simple as the current implementation of get_highest_by_messages
bearomorphism commented May 18, 2025
The tests finally passed... |
ecac37b to 83d6bdeCompare| 'MINOR' | ||
| """ | ||
| returnSemVerIncrement.get_highest( | ||
| get_increment(line) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need these logs. The algorithm can be very simple as the current implementation of
find_increment_by_callable
We can log the traces in get_increment though.
| try: | ||
| ifret:=SemVerIncrement.get_highest( | ||
| (incrementforname, incrementinbump_map.items() ifm.group(name)), | ||
| ): | ||
| returnret | ||
| exceptIndexError: | ||
| # Fallback to old school bump rule | ||
| pass |
bearomorphismMay 19, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This addresses the problem mentioned in #129
BumpRule, enum SemVerIncrement and Prerelease81d0457 to 2eaf52cComparebearomorphism commented May 19, 2025
Hope the doc string make it easier to review |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
2eaf52c to 2e090b4Compare2e090b4 to ffdaa62CompareBumpRule, enum SemVerIncrement and Prereleaseffdaa62 to 4f32a7fCompare4f32a7f to 52acd60Comparebaee83e to a9cd957Comparefc31bee to 4279a25CompareUh oh!
There was an error while loading. Please reload this page.
6e3caa5 to 8c7e2d3Compare8c7e2d3 to 9c3421cCompare
Closes#129
Description
Please see
bump_rule.py,bump.py,cz/base.py,version_scheme.pyandcommands/bump.py(~350 lines).The rest 1000+ lines are just tests and renaming.
CustomBumpRule.Simplified code.SemVerIncrementand replaceMAJOR,MINOR,PATCHwith the Enum.Prereleaseis Enum.find_incrementlogic inSemVerIncrement.get_highest_by_messages.find_incrementwas the combination of 2 features: "finding the highest semantic version increment" and "parsing the semantic version increment from each git commit message".Checklist
Code Changes
poetry alllocally to ensure this change passes linter check and testsDocumentation Changes
poetry doclocally to ensure the documentation pages renders correctlyExpected Behavior
Steps to Test This Pull Request
Additional Context