Skip to content

Commit

Permalink
Remove unused unused params in livecheck strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
dduugg committed Jan 12, 2025
1 parent 2432d01 commit 84c740a
Show file tree
Hide file tree
Showing 23 changed files with 76 additions and 104 deletions.
11 changes: 5 additions & 6 deletions Library/Homebrew/livecheck/strategy/apache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,15 @@ def self.generate_input_values(url)
# @return [Hash]
sig {
params(
url: String,
regex: T.nilable(Regexp),
unused: T.untyped,
block: T.nilable(Proc),
url: String,
regex: T.nilable(Regexp),
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: nil, **unused, &block)
def self.find_versions(url:, regex: nil, &block)
generated = generate_input_values(url)

PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block)
PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], &block)

Check warning on line 99 in Library/Homebrew/livecheck/strategy/apache.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/livecheck/strategy/apache.rb#L99

Added line #L99 was not covered by tests
end
end
end
Expand Down
11 changes: 5 additions & 6 deletions Library/Homebrew/livecheck/strategy/bitbucket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,15 @@ def self.generate_input_values(url)
# @return [Hash]
sig {
params(
url: String,
regex: T.nilable(Regexp),
unused: T.untyped,
block: T.nilable(Proc),
url: String,
regex: T.nilable(Regexp),
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: nil, **unused, &block)
def self.find_versions(url:, regex: nil, &block)
generated = generate_input_values(url)

PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block)
PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], &block)

Check warning on line 107 in Library/Homebrew/livecheck/strategy/bitbucket.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/livecheck/strategy/bitbucket.rb#L107

Added line #L107 was not covered by tests
end
end
end
Expand Down
11 changes: 5 additions & 6 deletions Library/Homebrew/livecheck/strategy/cpan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,15 @@ def self.generate_input_values(url)
# @return [Hash]
sig {
params(
url: String,
regex: T.nilable(Regexp),
unused: T.untyped,
block: T.nilable(Proc),
url: String,
regex: T.nilable(Regexp),
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: nil, **unused, &block)
def self.find_versions(url:, regex: nil, &block)
generated = generate_input_values(url)

PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block)
PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], &block)

Check warning on line 86 in Library/Homebrew/livecheck/strategy/cpan.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/livecheck/strategy/cpan.rb#L86

Added line #L86 was not covered by tests
end
end
end
Expand Down
3 changes: 1 addition & 2 deletions Library/Homebrew/livecheck/strategy/crate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,10 @@ def self.generate_input_values(url)
regex: T.nilable(Regexp),
provided_content: T.nilable(String),
homebrew_curl: T::Boolean,
_unused: T.untyped,
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: nil, provided_content: nil, homebrew_curl: false, **_unused, &block)
def self.find_versions(url:, regex: nil, provided_content: nil, homebrew_curl: false, &block)
match_data = { matches: {}, regex:, url: }
match_data[:cached] = true if provided_content.is_a?(String)

Expand Down
4 changes: 1 addition & 3 deletions Library/Homebrew/livecheck/strategy/electron_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ def self.match?(url)
url: String,
regex: T.nilable(Regexp),
provided_content: T.nilable(String),
unused: T.untyped,
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: nil, provided_content: nil, **unused, &block)
def self.find_versions(url:, regex: nil, provided_content: nil, &block)
if regex.present? && block.blank?
raise ArgumentError,
"#{Utils.demodulize(T.must(name))} only supports a regex when using a `strategy` block"
Expand All @@ -54,7 +53,6 @@ def self.find_versions(url:, regex: nil, provided_content: nil, **unused, &block
url:,
regex:,
provided_content:,
**unused,
&block || proc { |yaml| yaml["version"] }
)
end
Expand Down
11 changes: 5 additions & 6 deletions Library/Homebrew/livecheck/strategy/extract_plist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,13 @@ def self.versions_from_items(items, regex = nil, &block)
# @return [Hash]
sig {
params(
cask: Cask::Cask,
url: T.nilable(String),
regex: T.nilable(Regexp),
_unused: T.untyped,
block: T.nilable(Proc),
cask: Cask::Cask,
url: T.nilable(String),
regex: T.nilable(Regexp),
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(cask:, url: nil, regex: nil, **_unused, &block)
def self.find_versions(cask:, url: nil, regex: nil, &block)
if regex.present? && block.blank?
raise ArgumentError,
"#{Utils.demodulize(T.must(name))} only supports a regex when using a `strategy` block"
Expand Down
9 changes: 4 additions & 5 deletions Library/Homebrew/livecheck/strategy/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,12 @@ def self.versions_from_tags(tags, regex = nil, &block)
# @return [Hash]
sig {
params(
url: String,
regex: T.nilable(Regexp),
_unused: T.untyped,
block: T.nilable(Proc),
url: String,
regex: T.nilable(Regexp),
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: nil, **_unused, &block)
def self.find_versions(url:, regex: nil, &block)
match_data = { matches: {}, regex:, url: }

tags_data = tag_info(url, regex)
Expand Down
9 changes: 4 additions & 5 deletions Library/Homebrew/livecheck/strategy/github_latest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,12 @@ def self.generate_input_values(url)
# @return [Hash]
sig {
params(
url: String,
regex: Regexp,
_unused: T.untyped,
block: T.nilable(Proc),
url: String,
regex: Regexp,
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: GithubReleases::DEFAULT_REGEX, **_unused, &block)
def self.find_versions(url:, regex: GithubReleases::DEFAULT_REGEX, &block)
match_data = { matches: {}, regex:, url: }

generated = generate_input_values(url)
Expand Down
9 changes: 4 additions & 5 deletions Library/Homebrew/livecheck/strategy/github_releases.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,12 @@ def self.versions_from_content(content, regex, &block)
# @return [Hash]
sig {
params(
url: String,
regex: Regexp,
_unused: T.untyped,
block: T.nilable(Proc),
url: String,
regex: Regexp,
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: DEFAULT_REGEX, **_unused, &block)
def self.find_versions(url:, regex: DEFAULT_REGEX, &block)
match_data = { matches: {}, regex:, url: }

generated = generate_input_values(url)
Expand Down
10 changes: 4 additions & 6 deletions Library/Homebrew/livecheck/strategy/gnome.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,17 @@ def self.generate_input_values(url)
# @return [Hash]
sig {
params(
url: String,
regex: T.nilable(Regexp),
unused: T.untyped,
block: T.nilable(Proc),
url: String,
regex: T.nilable(Regexp),
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: nil, **unused, &block)
def self.find_versions(url:, regex: nil, &block)
generated = generate_input_values(url)

version_data = PageMatch.find_versions(
url: generated[:url],
regex: regex || generated[:regex],
**unused,
&block
)

Expand Down
11 changes: 5 additions & 6 deletions Library/Homebrew/livecheck/strategy/gnu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,15 @@ def self.generate_input_values(url)
# @return [Hash]
sig {
params(
url: String,
regex: T.nilable(Regexp),
unused: T.untyped,
block: T.nilable(Proc),
url: String,
regex: T.nilable(Regexp),
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: nil, **unused, &block)
def self.find_versions(url:, regex: nil, &block)
generated = generate_input_values(url)

PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block)
PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], &block)

Check warning on line 98 in Library/Homebrew/livecheck/strategy/gnu.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/livecheck/strategy/gnu.rb#L98

Added line #L98 was not covered by tests
end
end
end
Expand Down
11 changes: 5 additions & 6 deletions Library/Homebrew/livecheck/strategy/hackage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,15 @@ def self.generate_input_values(url)
# @return [Hash]
sig {
params(
url: String,
regex: T.nilable(Regexp),
unused: T.untyped,
block: T.nilable(Proc),
url: String,
regex: T.nilable(Regexp),
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: nil, **unused, &block)
def self.find_versions(url:, regex: nil, &block)
generated = generate_input_values(url)

PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block)
PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], &block)

Check warning on line 84 in Library/Homebrew/livecheck/strategy/hackage.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/livecheck/strategy/hackage.rb#L84

Added line #L84 was not covered by tests
end
end
end
Expand Down
3 changes: 1 addition & 2 deletions Library/Homebrew/livecheck/strategy/header_match.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,10 @@ def self.versions_from_headers(headers, regex = nil, &block)
url: String,
regex: T.nilable(Regexp),
homebrew_curl: T::Boolean,
_unused: T.untyped,
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: nil, homebrew_curl: false, **_unused, &block)
def self.find_versions(url:, regex: nil, homebrew_curl: false, &block)
match_data = { matches: {}, regex:, url: }

headers = Strategy.page_headers(url, homebrew_curl:)
Expand Down
3 changes: 1 addition & 2 deletions Library/Homebrew/livecheck/strategy/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,10 @@ def self.versions_from_content(content, regex = nil, &block)
regex: T.nilable(Regexp),
provided_content: T.nilable(String),
homebrew_curl: T::Boolean,
_unused: T.untyped,
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: nil, provided_content: nil, homebrew_curl: false, **_unused, &block)
def self.find_versions(url:, regex: nil, provided_content: nil, homebrew_curl: false, &block)
raise ArgumentError, "#{Utils.demodulize(T.must(name))} requires a `strategy` block" if block.blank?

match_data = { matches: {}, regex:, url: }
Expand Down
11 changes: 5 additions & 6 deletions Library/Homebrew/livecheck/strategy/launchpad.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,15 @@ def self.generate_input_values(url)
# @return [Hash]
sig {
params(
url: String,
regex: Regexp,
unused: T.untyped,
block: T.nilable(Proc),
url: String,
regex: Regexp,
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: DEFAULT_REGEX, **unused, &block)
def self.find_versions(url:, regex: DEFAULT_REGEX, &block)
generated = generate_input_values(url)

PageMatch.find_versions(url: generated[:url], regex:, **unused, &block)
PageMatch.find_versions(url: generated[:url], regex:, &block)

Check warning on line 81 in Library/Homebrew/livecheck/strategy/launchpad.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/livecheck/strategy/launchpad.rb#L81

Added line #L81 was not covered by tests
end
end
end
Expand Down
11 changes: 5 additions & 6 deletions Library/Homebrew/livecheck/strategy/npm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,15 @@ def self.generate_input_values(url)
# @return [Hash]
sig {
params(
url: String,
regex: T.nilable(Regexp),
unused: T.untyped,
block: T.nilable(Proc),
url: String,
regex: T.nilable(Regexp),
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: nil, **unused, &block)
def self.find_versions(url:, regex: nil, &block)
generated = generate_input_values(url)

PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block)
PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], &block)

Check warning on line 79 in Library/Homebrew/livecheck/strategy/npm.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/livecheck/strategy/npm.rb#L79

Added line #L79 was not covered by tests
end
end
end
Expand Down
3 changes: 1 addition & 2 deletions Library/Homebrew/livecheck/strategy/page_match.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,10 @@ def self.versions_from_content(content, regex, &block)
regex: T.nilable(Regexp),
provided_content: T.nilable(String),
homebrew_curl: T::Boolean,
_unused: T.untyped,
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: nil, provided_content: nil, homebrew_curl: false, **_unused, &block)
def self.find_versions(url:, regex: nil, provided_content: nil, homebrew_curl: false, &block)
if regex.blank? && block.blank?
raise ArgumentError, "#{Utils.demodulize(T.must(name))} requires a regex or `strategy` block"
end
Expand Down
4 changes: 1 addition & 3 deletions Library/Homebrew/livecheck/strategy/pypi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,10 @@ def self.generate_input_values(url)
url: String,
regex: T.nilable(Regexp),
provided_content: T.nilable(String),
unused: T.untyped,
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: nil, provided_content: nil, **unused, &block)
def self.find_versions(url:, regex: nil, provided_content: nil, &block)
match_data = { matches: {}, regex:, url: }

generated = generate_input_values(url)
Expand All @@ -99,7 +98,6 @@ def self.find_versions(url:, regex: nil, provided_content: nil, **unused, &block
url: generated[:url],
regex:,
provided_content:,
**unused,
&block || DEFAULT_BLOCK
)
end
Expand Down
10 changes: 4 additions & 6 deletions Library/Homebrew/livecheck/strategy/sourceforge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,17 @@ def self.generate_input_values(url)
# @return [Hash]
sig {
params(
url: String,
regex: T.nilable(Regexp),
unused: T.untyped,
block: T.nilable(Proc),
url: String,
regex: T.nilable(Regexp),
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: nil, **unused, &block)
def self.find_versions(url:, regex: nil, &block)
generated = generate_input_values(url)

PageMatch.find_versions(
url: generated[:url] || url,
regex: regex || generated[:regex],
**unused,
&block
)
end
Expand Down
9 changes: 4 additions & 5 deletions Library/Homebrew/livecheck/strategy/sparkle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,12 @@ def self.versions_from_content(content, regex = nil, &block)
# @return [Hash]
sig {
params(
url: String,
regex: T.nilable(Regexp),
_unused: T.untyped,
block: T.nilable(Proc),
url: String,
regex: T.nilable(Regexp),
block: T.nilable(Proc),
).returns(T::Hash[Symbol, T.untyped])
}
def self.find_versions(url:, regex: nil, **_unused, &block)
def self.find_versions(url:, regex: nil, &block)
if regex.present? && block.blank?
raise ArgumentError,
"#{Utils.demodulize(T.must(name))} only supports a regex when using a `strategy` block"
Expand Down
Loading

0 comments on commit 84c740a

Please sign in to comment.