Fix type checking errors.
This commit is contained in:
parent
c74d8434d6
commit
a014f65e41
@ -33,27 +33,18 @@ class FormulaInstaller
|
|||||||
include FormulaCellarChecks
|
include FormulaCellarChecks
|
||||||
extend Predicable
|
extend Predicable
|
||||||
|
|
||||||
def self.mode_attr_accessor(*names)
|
|
||||||
attr_accessor(*names)
|
|
||||||
|
|
||||||
private(*names)
|
|
||||||
names.each do |name|
|
|
||||||
predicate = "#{name}?"
|
|
||||||
define_method(predicate) do
|
|
||||||
send(name) ? true : false
|
|
||||||
end
|
|
||||||
private(predicate)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
attr_reader :formula
|
attr_reader :formula
|
||||||
attr_accessor :cc, :env, :options, :build_bottle, :bottle_arch,
|
attr_accessor :cc, :env, :options, :build_bottle, :bottle_arch,
|
||||||
:build_from_source_formulae, :include_test_formulae,
|
:build_from_source_formulae, :include_test_formulae,
|
||||||
:installed_as_dependency, :installed_on_request, :link_keg, :other_installers
|
:installed_as_dependency, :installed_on_request, :link_keg, :other_installers
|
||||||
|
|
||||||
mode_attr_accessor :show_summary_heading, :show_header
|
attr_predicate :show_summary_heading?, :show_header?
|
||||||
mode_attr_accessor :force_bottle, :ignore_deps, :only_deps, :interactive, :git, :force, :keep_tmp
|
attr_writer :show_header
|
||||||
mode_attr_accessor :verbose, :debug, :quiet
|
|
||||||
|
attr_predicate :force_bottle?, :ignore_deps?, :only_deps?, :interactive?, :git?, :force?, :keep_tmp?
|
||||||
|
attr_writer :force_bottle, :ignore_deps, :only_deps, :interactive, :git, :force, :keep_tmp
|
||||||
|
|
||||||
|
attr_predicate :verbose?, :debug?, :quiet?
|
||||||
|
|
||||||
def initialize(formula,
|
def initialize(formula,
|
||||||
force_bottle: false,
|
force_bottle: false,
|
||||||
@ -139,6 +130,7 @@ class FormulaInstaller
|
|||||||
!formula.bottle_disabled?
|
!formula.bottle_disabled?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { params(install_bottle_options: { warn: T::Boolean }).returns(T::Boolean) }
|
||||||
def pour_bottle?(install_bottle_options = { warn: false })
|
def pour_bottle?(install_bottle_options = { warn: false })
|
||||||
return false if @pour_failed
|
return false if @pour_failed
|
||||||
|
|
||||||
@ -173,16 +165,18 @@ class FormulaInstaller
|
|||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { params(dep: Formula, build: BuildOptions).returns(T::Boolean) }
|
||||||
def install_bottle_for?(dep, build)
|
def install_bottle_for?(dep, build)
|
||||||
return pour_bottle? if dep == formula
|
return pour_bottle? if dep == formula
|
||||||
return false if build_from_source_formulae.include?(dep.full_name)
|
return false if build_from_source_formulae.include?(dep.full_name)
|
||||||
return false unless dep.bottle && dep.pour_bottle?
|
return false unless dep.bottle && dep.pour_bottle?
|
||||||
return false unless build.used_options.empty?
|
return false unless build.used_options.empty?
|
||||||
return false unless dep.bottle.compatible_cellar?
|
return false unless dep.bottle&.compatible_cellar?
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { void }
|
||||||
def prelude
|
def prelude
|
||||||
Tab.clear_cache
|
Tab.clear_cache
|
||||||
verify_deps_exist unless ignore_deps?
|
verify_deps_exist unless ignore_deps?
|
||||||
@ -191,6 +185,7 @@ class FormulaInstaller
|
|||||||
check_install_sanity
|
check_install_sanity
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { void }
|
||||||
def verify_deps_exist
|
def verify_deps_exist
|
||||||
begin
|
begin
|
||||||
compute_dependencies
|
compute_dependencies
|
||||||
|
13
Library/Homebrew/sorbet/plugins/attr_predicate.rb
Normal file
13
Library/Homebrew/sorbet/plugins/attr_predicate.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# typed: strict
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
source = ARGV[5]
|
||||||
|
|
||||||
|
source.scan(/:([^?]+\?)/).flatten.each do |method|
|
||||||
|
puts <<~RUBY
|
||||||
|
# typed: strict
|
||||||
|
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
|
def #{method}; end
|
||||||
|
RUBY
|
||||||
|
end
|
@ -3,3 +3,4 @@ ruby_extra_args:
|
|||||||
|
|
||||||
triggers:
|
triggers:
|
||||||
using: sorbet/plugins/unpack_strategy_magic.rb
|
using: sorbet/plugins/unpack_strategy_magic.rb
|
||||||
|
attr_predicate: sorbet/plugins/attr_predicate.rb
|
||||||
|
Loading…
x
Reference in New Issue
Block a user