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: Match multiple digits in package versions #96

Merged
merged 1 commit into from
Dec 18, 2019

Conversation

robcresswell
Copy link
Contributor

The new requirements parser and tests were only matching single digits in version strings, such as 2.0.1, which falls over very quickly, for example when faced with flask==0.12.1.

This patch fixes the parser, and adds a test

The new requirements parser and tests were only matching single digits
in version strings, such as `2.0.1`, which falls over very quickly, for
example when faced with `flask==0.12.1`.

This patch fixes the parser, and adds a test
@robcresswell robcresswell requested a review from a team as a code owner December 18, 2019 10:53
@robcresswell robcresswell self-assigned this Dec 18, 2019
@ghost ghost requested review from lili2311 and orsagie December 18, 2019 10:53
@@ -35,7 +35,7 @@ export function parseRequirementsFile(requirementsFile: string): Requirement[] {

// Regex to match against a Python package specifier. Any invalid lines (or
// lines we can't handle) should have been returned this point.
const regex = /([A-Z0-9]*)(===|==|>=|<=|>|<|~=)(\d\.?\d?\.?\d?)(.*)/i;
const regex = /([A-Z0-9]*)(!=|==|>=|<=|>|<|~=)(\d*\.?\d*\.?\d*)(.*)/i;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also aligned this with the VersionComparator type by replacing === with !=

@robcresswell robcresswell merged commit b397444 into master Dec 18, 2019
@robcresswell robcresswell deleted the fix/match-multiple-digits-inpackage-versions branch December 18, 2019 11:10
@snyksec
Copy link

snyksec commented Dec 18, 2019

🎉 This PR is included in version 1.15.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants