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

Add back the Docker::Version.correct? method #8030

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docker/lib/dependabot/docker/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ def initialize(version)
super(@release_part)
end

def self.correct?(version)
return true if version.is_a?(Gem::Version)
# We can't call new here because Gem::Version calls self.correct? in its initialize method
# causing an infinite loop, so instead we check if the release_part of the version is correct
release_part, _ = version.split("_", 2)
release_part = release_part.sub("v", "").tr("-", ".")
super(release_part)
rescue ArgumentError
# if we can't instantiate a version, it can't be correct
false
end

def to_semver
@release_part.to_semver
end
Expand Down
Loading