Skip to content
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

Fix leading zeros #49

Merged
merged 3 commits into from
May 14, 2020
Merged

Fix leading zeros #49

merged 3 commits into from
May 14, 2020

Conversation

theory
Copy link
Owner

@theory theory commented May 10, 2020

In response to discussion on #45, properly prevent leading 0s in prerelease parts only when there are no alphanumeric characters. Also fix an issue where it would ignore the first leading 0 in a prerelease no matter what else was in the part.

Turns out that leading zeros are allowed if there are non-numeric characters
in a part. Previously, the code rejected a version such as `1.0.0-alpha.0a`
but now accepts it. It also now better enforces the no-leading-zeros rule,
where prviously `1.0.0-02799` was allowed and now is not. Resolves #45.
Already there, just testing.
@theory theory requested review from tdavis, maspalio and samv May 10, 2020 20:36
@theory theory self-assigned this May 10, 2020
This was referenced May 10, 2020
Copy link
Collaborator

@maspalio maspalio left a comment

Choose a reason for hiding this comment

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

+1
Thank you.

@theory theory merged commit 0f09f8e into master May 14, 2020
@theory theory deleted the fix-leading-zeros branch May 14, 2020 13:51
theory added a commit that referenced this pull request May 14, 2020
Add a test script with the official SemVer project test corpus, and fix the issues found. This
results in the exclusion of previously-accepted semvers, including:

* Metadata parts with additional plus signs, e.g., `9.8.7+meta+meta`
* Metadata or prerelease parts that start with a dot, e.g., `1.1.2+.123` or `1.1.2-.123`.

As with #49, we need to decide how to handle existing stored instances of such previously-
allowed values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants