-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add semver ignore-condition range code into python version #10844
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
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -214,6 +214,38 @@ def lowest_prerelease_suffix | |
| "dev0" | ||
| end | ||
|
|
||
| sig { override.returns(T::Array[String]) } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just overriding these from common/verison.rb |
||
| def ignored_patch_versions | ||
| parts = release_segment # e.g [1,2,3] if version is 1.2.3-alpha3 | ||
| version_parts = parts.fill(0, parts.length...2) | ||
| upper_parts = version_parts.first(1) + [version_parts[1].to_i + 1] + [lowest_prerelease_suffix] | ||
| lower_bound = "> #{self}" | ||
| upper_bound = "< #{upper_parts.join('.')}" | ||
|
|
||
| ["#{lower_bound}, #{upper_bound}"] | ||
| end | ||
|
|
||
| sig { override.returns(T::Array[String]) } | ||
| def ignored_minor_versions | ||
| parts = release_segment # e.g [1,2,3] if version is 1.2.3-alpha3 | ||
| version_parts = parts.fill(0, parts.length...2) | ||
| lower_parts = version_parts.first(1) + [version_parts[1].to_i + 1] + [lowest_prerelease_suffix] | ||
| upper_parts = version_parts.first(0) + [version_parts[0].to_i + 1] + [lowest_prerelease_suffix] | ||
| lower_bound = ">= #{lower_parts.join('.')}" | ||
| upper_bound = "< #{upper_parts.join('.')}" | ||
|
|
||
| ["#{lower_bound}, #{upper_bound}"] | ||
| end | ||
|
|
||
| sig { override.returns(T::Array[String]) } | ||
| def ignored_major_versions | ||
| version_parts = release_segment # e.g [1,2,3] if version is 1.2.3-alpha3 | ||
| lower_parts = [version_parts[0].to_i + 1] + [lowest_prerelease_suffix] # earliest next major version prerelease | ||
| lower_bound = ">= #{lower_parts.join('.')}" | ||
|
|
||
| [lower_bound] | ||
| end | ||
|
|
||
| private | ||
|
|
||
| sig { params(other: Dependabot::Python::Version).returns(Integer) } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,10 +77,6 @@ | |
| describe ".new" do | ||
| subject(:version) { described_class.new(version_string) } | ||
|
|
||
| before do | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't cleanup fully previously, but this is no longer needed. |
||
| Dependabot::Experiments.register(:python_new_version, true) | ||
| end | ||
|
|
||
| context "with an empty string" do | ||
| let(:version_string) { "" } | ||
| let(:error_msg) { "Malformed version string - string is empty" } | ||
|
|
@@ -342,6 +338,30 @@ | |
| it { is_expected.to eq "dev0" } | ||
| end | ||
|
|
||
| describe "#ignored_major_versions" do | ||
| subject(:ignored_versions) { version.ignored_major_versions } | ||
|
|
||
| let(:version_string) { "1.2.3-alpha.1" } | ||
|
|
||
| it { is_expected.to eq([">= 2.dev0"]) } | ||
| end | ||
|
|
||
| describe "#ignored_minor_versions" do | ||
| subject(:ignored_versions) { version.ignored_minor_versions } | ||
|
|
||
| let(:version_string) { "1.2.3-alpha.1" } | ||
|
|
||
| it { is_expected.to eq([">= 1.3.dev0, < 2.dev0"]) } | ||
| end | ||
|
|
||
| describe "#ignored_patch_versions" do | ||
| subject(:ignored_versions) { version.ignored_patch_versions } | ||
|
|
||
| let(:version_string) { "1.2.3-alpha.1" } | ||
|
|
||
| it { is_expected.to eq(["> #{version_string}, < 1.3.dev0"]) } | ||
| end | ||
|
|
||
| describe "compatibility with Gem::Requirement" do | ||
| subject { requirement.satisfied_by?(version) } | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We need to use th correct method that is ecosystem specific and not the one from gem version that checks against a completely different regex.