commitizen icon indicating copy to clipboard operation
commitizen copied to clipboard

feat(bump_rule): add BumpRule, VersionIncrement, Prerelease Enum

Open bearomorphism opened this issue 6 months ago • 8 comments

Related issue: #129 Original PR: #1431

Description

Please see bump_rule.py, bump.py, cz/base.py, version_scheme.py and commands/bump.py (~350 lines). The rest 1000+ lines are just tests and renaming.

  • Rewrote the bump pattern matching mechanism to make the algorithm more strict and maintainable.
  • Maintained backward compatibility with CustomBumpRule.
  • ~~Simplified code.~~
  • Added a new Enum class SemVerIncrement and replace MAJOR, MINOR, PATCH with the Enum.
  • Now Prerelease is Enum.
  • Simplify find_increment logic in SemVerIncrement.get_highest_by_messages.
    • find_increment was 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

  • [x] Add test cases to all the changes you introduce
  • [x] 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
    • [x] Ensure backward compatibility is maintained
    • [ ] Document any manual testing steps performed
  • [x] Update the documentation for the changes

Documentation Changes

  • [x] Run poetry doc locally to ensure the documentation pages renders correctly

Expected Behavior

Steps to Test This Pull Request

Additional Context

bearomorphism avatar Jun 09 '25 14:06 bearomorphism

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 98.71%. Comparing base (120d514) to head (9644e1a). :warning: Report is 842 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1518      +/-   ##
==========================================
+ Coverage   97.33%   98.71%   +1.37%     
==========================================
  Files          42       61      +19     
  Lines        2104     2722     +618     
==========================================
+ Hits         2048     2687     +639     
+ Misses         56       35      -21     
Flag Coverage Δ
unittests 98.71% <100.00%> (+1.37%) :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.

codecov[bot] avatar Jun 09 '25 15:06 codecov[bot]

Can we do squash rebase on this PR when it is ready for merge?

bearomorphism avatar Aug 24 '25 14:08 bearomorphism

Can we do squash rebase on this PR when it is ready for merge?

yep, I can do that

Lee-W avatar Aug 25 '25 01:08 Lee-W

What are the next steps for this PR? If there are backward compatibility issues, I can adjust it so that this PR can be checked in. Thanks

bearomorphism avatar Sep 08 '25 02:09 bearomorphism

We can get back to this PR after #1598

bearomorphism avatar Sep 25 '25 07:09 bearomorphism

@Lee-W It would be great if we can complete this big PR. I can fix those backward-compatibility issues, but I need more details so I can address the issues.

bearomorphism avatar Nov 11 '25 15:11 bearomorphism

(I've resolved merge conflicts for several times for this PR)

bearomorphism avatar Nov 11 '25 15:11 bearomorphism

This would fall into 4.11.0. Let's foucs on merging the non-features PRs first and then get back to this one.

Lee-W avatar Nov 13 '25 01:11 Lee-W