-
-
Notifications
You must be signed in to change notification settings - Fork 302
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
566e8ec to
03aa596
Compare
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
be7cb23
Compare
deae807 to
88efb61
Compare
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.
| if new_increment is None: | ||
| logger.debug( | ||
| f"no increment needed for '{found_keyword}' in '{message}'" | ||
| ) | ||
|
|
||
| if VERSION_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 |
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
|
The tests finally passed... |
ecac37b to
83d6bde
Compare
| 'MINOR' | ||
| """ | ||
| return SemVerIncrement.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: | ||
| if ret := SemVerIncrement.get_highest( | ||
| (increment for name, increment in bump_map.items() if m.group(name)), | ||
| ): | ||
| return ret | ||
| except IndexError: | ||
| # Fallback to old school bump rule | ||
| pass |
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 Prerelease
81d0457 to
2eaf52c
Compare
|
Hope the doc string make it easier to review |
2eaf52c to
2e090b4
Compare
2e090b4 to
ffdaa62
Compare
BumpRule, enum SemVerIncrement and Prereleaseffdaa62 to
4f32a7f
Compare
4f32a7f to
52acd60
Compare
baee83e to
a9cd957
Compare
fc31bee to
4279a25
Compare
6e3caa5 to
8c7e2d3
Compare
8c7e2d3 to
9c3421c
Compare
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