Skip to content

Commit

Permalink
livecheck: create constant for no versions message
Browse files Browse the repository at this point in the history
  • Loading branch information
samford committed Feb 19, 2025
1 parent 42446d0 commit cd648a0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Library/Homebrew/livecheck/livecheck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module Homebrew
# for formulae.
module Livecheck
NO_CURRENT_VERSION_MSG = "Unable to identify current version"
NO_VERSIONS_MSG = "Unable to get versions"

UNSTABLE_VERSION_KEYWORDS = T.let(%w[
alpha
Expand Down Expand Up @@ -299,7 +300,7 @@ def self.run_checks(
verbose:,
)
if res_version_info.empty?
status_hash(resource, "error", ["Unable to get versions"], verbose:)
status_hash(resource, "error", [NO_VERSIONS_MSG], verbose:)
else
res_version_info
end
Expand All @@ -309,13 +310,12 @@ def self.run_checks(
end

if latest.blank?
no_versions_msg = "Unable to get versions"
raise Livecheck::Error, no_versions_msg unless json
raise Livecheck::Error, NO_VERSIONS_MSG unless json
next if quiet

next version_info if version_info.is_a?(Hash) && version_info[:status] && version_info[:messages]

latest_info = status_hash(formula_or_cask, "error", [no_versions_msg], full_name: use_full_name,
latest_info = status_hash(formula_or_cask, "error", [NO_VERSIONS_MSG], full_name: use_full_name,

Check warning on line 318 in Library/Homebrew/livecheck/livecheck.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/livecheck/livecheck.rb#L318

Added line #L318 was not covered by tests
verbose:)
if check_for_resources
unless verbose
Expand Down Expand Up @@ -996,7 +996,7 @@ def self.resource_version(
res_current = T.must(resource.version)
res_latest = Version.new(match_version_map.values.max_by { |v| LivecheckVersion.create(resource, v) })

return status_hash(resource, "error", ["Unable to get versions"], verbose:) if res_latest.blank?
return status_hash(resource, "error", [NO_VERSIONS_MSG], verbose:) if res_latest.blank?

is_outdated = res_current < res_latest
is_newer_than_upstream = res_current > res_latest
Expand Down

0 comments on commit cd648a0

Please sign in to comment.