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

sorbet: Tighten up dev-cmd types #17625

Merged
merged 2 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Library/Homebrew/dev-cmd/bump-formula-pr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def check_new_version(formula, tap_remote_repo, version: nil, url: nil, tag: nil
check_closed_pull_requests(formula, tap_remote_repo, version:)
end

sig { params(formula: Formula, new_version: String).returns(NilClass) }
sig { params(formula: Formula, new_version: String).void }
def check_throttle(formula, new_version)
tap = formula.tap
return if tap.nil?
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/dev-cmd/bump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def retrieve_pull_requests(formula_or_cask, name, state:, version: nil)
sig {
params(
formula_or_cask: T.any(Formula, Cask::Cask),
repositories: T::Array[T.untyped],
repositories: T::Array[String],
name: String,
).returns(VersionBumpInfo)
}
Expand Down Expand Up @@ -425,7 +425,7 @@ def retrieve_versions_by_arch(formula_or_cask:, repositories:, name:)
params(
formula_or_cask: T.any(Formula, Cask::Cask),
name: String,
repositories: T::Array[T.untyped],
repositories: T::Array[String],
ambiguous_cask: T::Boolean,
).void
}
Expand Down
10 changes: 6 additions & 4 deletions Library/Homebrew/dev-cmd/unbottled.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@
T.let(formula_installs, T.nilable(T::Hash[Symbol, Integer]))]
end

sig { params(all_formulae: T.untyped).returns([T::Hash[String, T.untyped], T::Hash[String, T.untyped]]) }
sig {
params(all_formulae: T::Array[Formula]).returns([T::Hash[String, T.untyped], T::Hash[String, T.untyped]])

Check warning on line 168 in Library/Homebrew/dev-cmd/unbottled.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/dev-cmd/unbottled.rb#L168

Added line #L168 was not covered by tests
}
def deps_uses_from_formulae(all_formulae)
ohai "Populating dependency tree..."

Expand All @@ -186,7 +188,7 @@
[deps_hash, uses_hash]
end

sig { params(formulae: T::Array[Formula]).returns(NilClass) }
sig { params(formulae: T::Array[Formula]).void }
def output_total(formulae)
return unless @bottle_tag

Expand All @@ -205,7 +207,7 @@
sig {
params(formulae: T::Array[Formula], deps_hash: T::Hash[T.any(Symbol, String), T.untyped],
noun: T.nilable(String), hash: T::Hash[T.any(Symbol, String), T.untyped],
any_named_args: T::Boolean).returns(NilClass)
any_named_args: T::Boolean).void
}
def output_unbottled(formulae, deps_hash, noun, hash, any_named_args)
return unless @bottle_tag
Expand Down Expand Up @@ -279,7 +281,7 @@
puts "No unbottled dependencies found!"
end

sig { returns(NilClass) }
sig { void }
def output_lost_bottles
ohai ":#{@bottle_tag} lost bottles"

Expand Down
8 changes: 4 additions & 4 deletions Library/Homebrew/dev-cmd/update-sponsors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
named_sponsors = []
logo_sponsors = []
# FIXME: This T.let should be unnecessary https://github.com/sorbet/sorbet/issues/6894
issyl0 marked this conversation as resolved.
Show resolved Hide resolved
largest_monthly_amount = T.let(0, T.untyped)
largest_monthly_amount = T.let(0, Integer)

Check warning on line 29 in Library/Homebrew/dev-cmd/update-sponsors.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/dev-cmd/update-sponsors.rb#L29

Added line #L29 was not covered by tests

GitHub.sponsorships("Homebrew").each do |s|
largest_monthly_amount = [s[:monthly_amount], s[:closest_tier_monthly_amount]].max
Expand Down Expand Up @@ -62,17 +62,17 @@

private

sig { params(sponsor: T::Hash[Symbol, T.untyped]).returns(T.nilable(String)) }
sig { params(sponsor: T::Hash[Symbol, String]).returns(T.nilable(String)) }
def sponsor_name(sponsor)
sponsor[:name] || sponsor[:login]
end

sig { params(sponsor: T::Hash[Symbol, T.untyped]).returns(String) }
sig { params(sponsor: T::Hash[Symbol, String]).returns(String) }
def sponsor_logo(sponsor)
"https://github.com/#{sponsor[:login]}.png?size=64"
end

sig { params(sponsor: T::Hash[Symbol, T.untyped]).returns(String) }
sig { params(sponsor: T::Hash[Symbol, String]).returns(String) }
def sponsor_url(sponsor)
"https://github.com/#{sponsor[:login]}"
end
Expand Down
Loading