Fix strict typecheck errors.

This commit is contained in:
Jonathan Chang 2020-10-28 18:49:10 +11:00
parent f7492c0a54
commit 55dc8bbada
8 changed files with 20 additions and 0 deletions

View File

@ -4,6 +4,8 @@
class Cleaner class Cleaner
private private
extend T::Sig
sig { params(path: Pathname).returns(T.nilable(T::Boolean)) }
def executable_path?(path) def executable_path?(path)
path.elf? || path.text_executable? path.elf? || path.text_executable?
end end

View File

@ -2,6 +2,8 @@
# frozen_string_literal: true # frozen_string_literal: true
module FormulaCellarChecks module FormulaCellarChecks
extend T::Sig
sig { params(filename: Pathname).returns(T::Boolean) }
def valid_library_extension?(filename) def valid_library_extension?(filename)
generic_valid_library_extension?(filename) || filename.basename.to_s.include?(".so.") generic_valid_library_extension?(filename) || filename.basename.to_s.include?(".so.")
end end

View File

@ -2,6 +2,8 @@
# frozen_string_literal: true # frozen_string_literal: true
class BottleSpecification class BottleSpecification
extend T::Sig
sig { returns(T::Boolean) }
def skip_relocation? def skip_relocation?
false false
end end

View File

@ -4,12 +4,15 @@
module Utils module Utils
module Analytics module Analytics
class << self class << self
extend T::Sig
sig { returns(String) }
def formula_path def formula_path
return generic_formula_path if Homebrew::EnvConfig.force_homebrew_on_linux? return generic_formula_path if Homebrew::EnvConfig.force_homebrew_on_linux?
"formula-linux" "formula-linux"
end end
sig { returns(String) }
def analytics_path def analytics_path
return generic_analytics_path if Homebrew::EnvConfig.force_homebrew_on_linux? return generic_analytics_path if Homebrew::EnvConfig.force_homebrew_on_linux?

View File

@ -2,6 +2,8 @@
# frozen_string_literal: true # frozen_string_literal: true
class KegOnlyReason class KegOnlyReason
extend T::Sig
sig { returns(T::Boolean) }
def applicable? def applicable?
true true
end end

View File

@ -2,6 +2,8 @@
# frozen_string_literal: true # frozen_string_literal: true
module Hardware module Hardware
extend T::Sig
sig { params(version: T.nilable(Version)).returns(Symbol) }
def self.oldest_cpu(version = MacOS.version) def self.oldest_cpu(version = MacOS.version)
if CPU.arch == :arm64 if CPU.arch == :arm64
:arm_vortex_tempest :arm_vortex_tempest

View File

@ -8,7 +8,10 @@ require "cask/caskroom"
module Homebrew module Homebrew
module MissingFormula module MissingFormula
extend T::Sig
class << self class << self
extend T::Sig
sig { params(name: String).returns(T.nilable(String)) }
def disallowed_reason(name) def disallowed_reason(name)
case name.downcase case name.downcase
when "xcode" when "xcode"
@ -33,12 +36,14 @@ module Homebrew
end end
end end
sig { params(name: String, silent: T::Boolean, show_info: T::Boolean).returns(T.nilable(String)) }
def cask_reason(name, silent: false, show_info: false) def cask_reason(name, silent: false, show_info: false)
return if silent return if silent
suggest_command(name, show_info ? "info" : "install") suggest_command(name, show_info ? "info" : "install")
end end
sig { params(name: String, command: String).returns(T.nilable(String)) }
def suggest_command(name, command) def suggest_command(name, command)
suggestion = <<~EOS suggestion = <<~EOS
Found a cask named "#{name}" instead. Try Found a cask named "#{name}" instead. Try

View File

@ -4,6 +4,8 @@
module Utils module Utils
module Analytics module Analytics
class << self class << self
extend T::Sig
sig { returns(String) }
def custom_prefix_label def custom_prefix_label
"non-/usr/local" "non-/usr/local"
end end