From 2194f6e12b0854a25150130e6345459a6b2be2e0 Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Fri, 24 Jun 2022 00:08:25 -0400 Subject: [PATCH] Only require livecheck block URL when appropriate `ExtractPlist` doesn't require a URL like other strategies (it takes a `Cask` instead) but we've had to provide one in existing `livecheck` blocks to get past this requirement in livecheck. This commit makes it so this requirement is only enforced when a strategy's `#find_versions` method has a required `url` parameter (not an optional one, as in `ExtractPlist`). --- Library/Homebrew/livecheck/livecheck.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/livecheck/livecheck.rb b/Library/Homebrew/livecheck/livecheck.rb index f0a2056835..bdc25c3371 100644 --- a/Library/Homebrew/livecheck/livecheck.rb +++ b/Library/Homebrew/livecheck/livecheck.rb @@ -563,6 +563,7 @@ module Homebrew # Identifies the latest version of the formula and returns a Hash containing # the version information. Returns nil if a latest version couldn't be found. + # rubocop:disable Metrics/CyclomaticComplexity sig { params( formula_or_cask: T.any(Formula, Cask::Cask), @@ -657,7 +658,7 @@ module Homebrew end if livecheck_strategy.present? - if livecheck_url.blank? + if livecheck_url.blank? && strategy.method(:find_versions).parameters.include?([:keyreq, :url]) odebug "#{strategy_name} strategy requires a URL" next elsif livecheck_strategy != :page_match && strategies.exclude?(strategy) @@ -768,6 +769,7 @@ module Homebrew nil end + # rubocop:enable Metrics/CyclomaticComplexity end # rubocop:enable Metrics/ModuleLength end