Enable strict typing in Tap

This commit is contained in:
Douglas Eichelberger 2025-08-03 15:44:38 -07:00 committed by Douglas Eichelberger
parent 9f05f0e625
commit 40c58a883d
No known key found for this signature in database
4 changed files with 379 additions and 258 deletions

View File

@ -207,7 +207,7 @@ module Homebrew
if pull_request if pull_request
# This is a tap pull request and approving reviewers should also sign-off. # This is a tap pull request and approving reviewers should also sign-off.
tap = Tap.from_path(git_repo.pathname) tap = T.must(Tap.from_path(git_repo.pathname))
review_trailers = GitHub.approved_reviews(tap.user, tap.full_name.split("/").last, review_trailers = GitHub.approved_reviews(tap.user, tap.full_name.split("/").last,
pull_request).map do |r| pull_request).map do |r|
"Signed-off-by: #{r["name"]} <#{r["email"]}>" "Signed-off-by: #{r["name"]} <#{r["email"]}>"
@ -253,7 +253,7 @@ module Homebrew
} }
def determine_bump_subject(old_contents, new_contents, subject_path, reason: nil) def determine_bump_subject(old_contents, new_contents, subject_path, reason: nil)
subject_path = Pathname(subject_path) subject_path = Pathname(subject_path)
tap = Tap.from_path(subject_path) tap = T.must(Tap.from_path(subject_path))
subject_name = subject_path.basename.to_s.chomp(".rb") subject_name = subject_path.basename.to_s.chomp(".rb")
is_cask = subject_path.to_s.start_with?("#{tap.cask_dir}/") is_cask = subject_path.to_s.start_with?("#{tap.cask_dir}/")
name = is_cask ? "cask" : "formula" name = is_cask ? "cask" : "formula"

View File

@ -41,8 +41,8 @@ module Homebrew
titleized_user = tap.user.dup titleized_user = tap.user.dup
titleized_repository = tap.repository.dup titleized_repository = tap.repository.dup
titleized_user[0] = titleized_user[0].upcase titleized_user[0] = T.must(titleized_user[0]).upcase
titleized_repository[0] = titleized_repository[0].upcase titleized_repository[0] = T.must(titleized_repository[0]).upcase
# Duplicate assignment to silence `assigned but unused variable` warning # Duplicate assignment to silence `assigned but unused variable` warning
root_url = root_url = GitHubPackages.root_url(tap.user, "homebrew-#{tap.repository}") if args.github_packages? root_url = root_url = GitHubPackages.root_url(tap.user, "homebrew-#{tap.repository}") if args.github_packages?

View File

@ -548,7 +548,7 @@ module Homebrew
core_cask_tap = CoreCaskTap.instance core_cask_tap = CoreCaskTap.instance
return unless core_cask_tap.installed? return unless core_cask_tap.installed?
broken_tap(core_cask_tap) || examine_git_origin(core_cask_tap.git_repository, core_cask_tap.remote) broken_tap(core_cask_tap) || examine_git_origin(core_cask_tap.git_repository, T.must(core_cask_tap.remote))
end end
sig { returns(T.nilable(String)) } sig { returns(T.nilable(String)) }

File diff suppressed because it is too large Load Diff