From 55dc8bbada63593bc5d4a8cdde6509ccd587f438 Mon Sep 17 00:00:00 2001 From: Jonathan Chang Date: Wed, 28 Oct 2020 18:49:10 +1100 Subject: [PATCH] Fix strict typecheck errors. --- Library/Homebrew/extend/os/linux/cleaner.rb | 2 ++ Library/Homebrew/extend/os/linux/formula_cellar_checks.rb | 2 ++ Library/Homebrew/extend/os/linux/software_spec.rb | 2 ++ Library/Homebrew/extend/os/linux/utils/analytics.rb | 3 +++ Library/Homebrew/extend/os/mac/formula_support.rb | 2 ++ Library/Homebrew/extend/os/mac/hardware.rb | 2 ++ Library/Homebrew/extend/os/mac/missing_formula.rb | 5 +++++ Library/Homebrew/extend/os/mac/utils/analytics.rb | 2 ++ 8 files changed, 20 insertions(+) diff --git a/Library/Homebrew/extend/os/linux/cleaner.rb b/Library/Homebrew/extend/os/linux/cleaner.rb index 230e2a8cac..8ac06950da 100644 --- a/Library/Homebrew/extend/os/linux/cleaner.rb +++ b/Library/Homebrew/extend/os/linux/cleaner.rb @@ -4,6 +4,8 @@ class Cleaner private + extend T::Sig + sig { params(path: Pathname).returns(T.nilable(T::Boolean)) } def executable_path?(path) path.elf? || path.text_executable? end diff --git a/Library/Homebrew/extend/os/linux/formula_cellar_checks.rb b/Library/Homebrew/extend/os/linux/formula_cellar_checks.rb index fa2e499452..11eb2a0db0 100644 --- a/Library/Homebrew/extend/os/linux/formula_cellar_checks.rb +++ b/Library/Homebrew/extend/os/linux/formula_cellar_checks.rb @@ -2,6 +2,8 @@ # frozen_string_literal: true module FormulaCellarChecks + extend T::Sig + sig { params(filename: Pathname).returns(T::Boolean) } def valid_library_extension?(filename) generic_valid_library_extension?(filename) || filename.basename.to_s.include?(".so.") end diff --git a/Library/Homebrew/extend/os/linux/software_spec.rb b/Library/Homebrew/extend/os/linux/software_spec.rb index 7d118fdc39..6240666cf1 100644 --- a/Library/Homebrew/extend/os/linux/software_spec.rb +++ b/Library/Homebrew/extend/os/linux/software_spec.rb @@ -2,6 +2,8 @@ # frozen_string_literal: true class BottleSpecification + extend T::Sig + sig { returns(T::Boolean) } def skip_relocation? false end diff --git a/Library/Homebrew/extend/os/linux/utils/analytics.rb b/Library/Homebrew/extend/os/linux/utils/analytics.rb index b4aa28f00d..c183cbf614 100644 --- a/Library/Homebrew/extend/os/linux/utils/analytics.rb +++ b/Library/Homebrew/extend/os/linux/utils/analytics.rb @@ -4,12 +4,15 @@ module Utils module Analytics class << self + extend T::Sig + sig { returns(String) } def formula_path return generic_formula_path if Homebrew::EnvConfig.force_homebrew_on_linux? "formula-linux" end + sig { returns(String) } def analytics_path return generic_analytics_path if Homebrew::EnvConfig.force_homebrew_on_linux? diff --git a/Library/Homebrew/extend/os/mac/formula_support.rb b/Library/Homebrew/extend/os/mac/formula_support.rb index a70d6f3bc8..64e8d14726 100644 --- a/Library/Homebrew/extend/os/mac/formula_support.rb +++ b/Library/Homebrew/extend/os/mac/formula_support.rb @@ -2,6 +2,8 @@ # frozen_string_literal: true class KegOnlyReason + extend T::Sig + sig { returns(T::Boolean) } def applicable? true end diff --git a/Library/Homebrew/extend/os/mac/hardware.rb b/Library/Homebrew/extend/os/mac/hardware.rb index ab53b4fd48..fb5d8bd58e 100644 --- a/Library/Homebrew/extend/os/mac/hardware.rb +++ b/Library/Homebrew/extend/os/mac/hardware.rb @@ -2,6 +2,8 @@ # frozen_string_literal: true module Hardware + extend T::Sig + sig { params(version: T.nilable(Version)).returns(Symbol) } def self.oldest_cpu(version = MacOS.version) if CPU.arch == :arm64 :arm_vortex_tempest diff --git a/Library/Homebrew/extend/os/mac/missing_formula.rb b/Library/Homebrew/extend/os/mac/missing_formula.rb index cd9ce82328..37ec0c0273 100644 --- a/Library/Homebrew/extend/os/mac/missing_formula.rb +++ b/Library/Homebrew/extend/os/mac/missing_formula.rb @@ -8,7 +8,10 @@ require "cask/caskroom" module Homebrew module MissingFormula + extend T::Sig class << self + extend T::Sig + sig { params(name: String).returns(T.nilable(String)) } def disallowed_reason(name) case name.downcase when "xcode" @@ -33,12 +36,14 @@ module Homebrew 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) return if silent suggest_command(name, show_info ? "info" : "install") end + sig { params(name: String, command: String).returns(T.nilable(String)) } def suggest_command(name, command) suggestion = <<~EOS Found a cask named "#{name}" instead. Try diff --git a/Library/Homebrew/extend/os/mac/utils/analytics.rb b/Library/Homebrew/extend/os/mac/utils/analytics.rb index ceba5b2649..39267b6b94 100644 --- a/Library/Homebrew/extend/os/mac/utils/analytics.rb +++ b/Library/Homebrew/extend/os/mac/utils/analytics.rb @@ -4,6 +4,8 @@ module Utils module Analytics class << self + extend T::Sig + sig { returns(String) } def custom_prefix_label "non-/usr/local" end