Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(schemes): adds support for SemVer 2.0 (dot in pre-releases) (fix #1025) #1072

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

Merged
noirbizarre merged 1 commit into commitizen-tools:master from noirbizarre:feature/semver2
Apr 18, 2024

Conversation

Copy link
Member

@noirbizarre noirbizarre commented Apr 18, 2024
edited
Loading

Description

This PR adds a semver2 version scheme which is applying strict prerelease formatting as described in SemVer 2 Item 9 and Semver 2.0.0 Item 11, meaning:

  • each prelease identifier should be separated by a dot
  • dash is part of the identifier, not a separator
  • precedence rules should be applied on identifiers

As a consequence, the 1.2.3-alpha0 form is not respecting those rules (1.2.3-alpha10 has not proper precedence over 1.2.3-alpha2), nor 1.2.3-alpha.0-dev.0 as its prerelease identifiers will be alpha, 0-dev, 0 while it should be alpha, 0, dev and 0.

Note that Semver 2 is underspecified on this point (there is no formal description of what are the expected prerelease identifiers, only example) and so this PR chose to stay close to the examples (use of alpha and beta instead of a and b), but this is choice, not a specification requirement.

Checklist

  • Add test cases to all the changes you introduce
  • Run ./scripts/format and ./scripts/test locally to ensure this change passes linter check and test
  • Test the changes on the local machine manually
  • Update the documentation for the changes

Expected behavior

SemVer 2.0 versions are properly parsed and bumped, the resulting version is SemVer 2,0 compliant too.

Steps to Test This Pull Request

  1. Defined version_scheme = "semver2" in you commitizen config
  2. Bump a dev release, it should have the form x.y.z-dev.D
  3. Bump an alpha release, it should have the form x.y.z-alpha.A
  4. Bump an alpha dev release, it should have the form x.y.z-alpha.A.dev.D

Additional context

Fixes #1025

Note

I think it's time for removing the version-type deprecated by vesion-scheme (in another PR)

woile reacted with thumbs up emoji
Copy link

codecov bot commented Apr 18, 2024
edited
Loading

Codecov Report

Attention: Patch coverage is 92.85714% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 97.53%. Comparing base (120d514) to head (d30fa81).
Report is 283 commits behind head on master.

Files Patch % Lines
commitizen/version_schemes.py 92.85% 2 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@
## master #1072 +/- ##
==========================================
+ Coverage 97.33% 97.53% +0.19% 
==========================================
 Files 42 55 +13 
 Lines 2104 2477 +373 
==========================================
+ Hits 2048 2416 +368 
- Misses 56 61 +5 
Flag Coverage Δ
unittests 97.53% <92.85%> (+0.19%) ⬆️

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.

Copy link
Member

@woile woile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work again 🎉
I'm in for a breaking change cleaning up some old deprecated flags.

noirbizarre reacted with heart emoji
Copy link
Member Author

noirbizarre commented Apr 18, 2024
edited
Loading

I'll do a dedicated PR dropping all deprecations. Given it will breaking, maybe we should discuss what other breaking changes we want to include (like maybe #996 (comment)).
I'll open an issue to track those: #1073

@noirbizarre noirbizarre changed the title (削除) feat(schemes): adds support for SemVer 2.0 (dot in pre-releases) (削除ここまで) (追記) feat(schemes): adds support for SemVer 2.0 (dot in pre-releases) (fix #1025) (追記ここまで) Apr 18, 2024
@noirbizarre noirbizarre merged commit 2ad26e0 into commitizen-tools:master Apr 18, 2024
@noirbizarre noirbizarre deleted the feature/semver2 branch April 18, 2024 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@woile woile woile approved these changes

@Lee-W Lee-W Awaiting requested review from Lee-W Lee-W is a code owner

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Generated pre-release part of SemVer differs from SemVer spec

AltStyle によって変換されたページ (->オリジナル) /