Skip to content

Commit

Permalink
Corrected log_if_version_malformed
Browse files Browse the repository at this point in the history
  • Loading branch information
randhircs committed Jan 14, 2025
1 parent e5261c5 commit d9dfa0f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions python/lib/dependabot/python/file_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,15 @@ def setup_python_environment
nil
end

sig { params(package_manager: String, version: String).void }
sig { params(package_manager: String, version: String).returns(T.nilable(T::Boolean)) }
def log_if_version_malformed(package_manager, version)
# logs warning if malformed version is found
return true if version.match?(/^\d+(?:\.\d+)*$/)

Dependabot.logger.warn(
"Detected #{package_manager} with malformed version #{version}"
)
if version.match?(/^\d+(?:\.\d+)*$/)
true
else
Dependabot.logger.warn("Detected #{package_manager} with malformed version #{version}")
false
end
end

sig { returns(String) }
Expand Down

0 comments on commit d9dfa0f

Please sign in to comment.