dev-cmd/pr-upload: Bump to Sorbet typed: strict

This commit is contained in:
Issy Long 2024-06-30 20:58:10 +01:00
parent d5af469e85
commit 6b995ad111
No known key found for this signature in database

View File

@ -1,4 +1,4 @@
# typed: true # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
require "abstract_command" require "abstract_command"
@ -120,6 +120,7 @@ module Homebrew
private private
sig { params(bottles_hash: T::Hash[String, T.untyped]).void }
def check_bottled_formulae!(bottles_hash) def check_bottled_formulae!(bottles_hash)
bottles_hash.each do |name, bottle_hash| bottles_hash.each do |name, bottle_hash|
formula_path = HOMEBREW_REPOSITORY/bottle_hash["formula"]["path"] formula_path = HOMEBREW_REPOSITORY/bottle_hash["formula"]["path"]
@ -131,22 +132,25 @@ module Homebrew
end end
end end
sig { params(bottles_hash: T::Hash[String, T.untyped]).returns(T::Boolean) }
def github_releases?(bottles_hash) def github_releases?(bottles_hash)
@github_releases ||= bottles_hash.values.all? do |bottle_hash| @github_releases ||= T.let(bottles_hash.values.all? do |bottle_hash|
root_url = bottle_hash["bottle"]["root_url"] root_url = bottle_hash["bottle"]["root_url"]
url_match = root_url.match GitHubReleases::URL_REGEX url_match = root_url.match GitHubReleases::URL_REGEX
_, _, _, tag = *url_match _, _, _, tag = *url_match
tag tag
end end, T.nilable(T::Boolean))
end end
sig { params(bottles_hash: T::Hash[String, T.untyped]).returns(T::Boolean) }
def github_packages?(bottles_hash) def github_packages?(bottles_hash)
@github_packages ||= bottles_hash.values.all? do |bottle_hash| @github_packages ||= T.let(bottles_hash.values.all? do |bottle_hash|
bottle_hash["bottle"]["root_url"].match? GitHubPackages::URL_REGEX bottle_hash["bottle"]["root_url"].match? GitHubPackages::URL_REGEX
end end, T.nilable(T::Boolean))
end end
sig { params(json_files: T::Array[String], args: T.untyped).returns(T::Hash[String, T.untyped]) }
def bottles_hash_from_json_files(json_files, args) def bottles_hash_from_json_files(json_files, args)
puts "Reading JSON files: #{json_files.join(", ")}" if args.verbose? puts "Reading JSON files: #{json_files.join(", ")}" if args.verbose?