missing_formula: Bump to Sorbet typed: strict

This commit is contained in:
Issy Long 2024-08-10 00:06:29 +01:00
parent 87e5fedc16
commit becc4991d0
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 "formulary" require "formulary"
@ -7,11 +7,13 @@ module Homebrew
# Helper module for checking if there is a reason a formula is missing. # Helper module for checking if there is a reason a formula is missing.
module MissingFormula module MissingFormula
class << self class << self
sig { params(name: String, silent: T::Boolean, show_info: T::Boolean).returns(T.nilable(String)) }
def reason(name, silent: false, show_info: false) def reason(name, silent: false, show_info: false)
cask_reason(name, silent:, show_info:) || disallowed_reason(name) || cask_reason(name, silent:, show_info:) || disallowed_reason(name) ||
tap_migration_reason(name) || deleted_reason(name, silent:) tap_migration_reason(name) || deleted_reason(name, silent:)
end end
sig { params(name: String).returns(T.nilable(String)) }
def disallowed_reason(name) def disallowed_reason(name)
case name.downcase case name.downcase
when "gem", /^rubygems?$/ then <<~EOS when "gem", /^rubygems?$/ then <<~EOS
@ -93,6 +95,7 @@ module Homebrew
end end
alias generic_disallowed_reason disallowed_reason alias generic_disallowed_reason disallowed_reason
sig { params(name: String).returns(T.nilable(String)) }
def tap_migration_reason(name) def tap_migration_reason(name)
message = T.let(nil, T.nilable(String)) message = T.let(nil, T.nilable(String))
@ -127,6 +130,7 @@ module Homebrew
message message
end end
sig { params(name: String, silent: T::Boolean).returns(T.nilable(String)) }
def deleted_reason(name, silent: false) def deleted_reason(name, silent: false)
path = Formulary.path name path = Formulary.path name
return if File.exist? path return if File.exist? path