Turn up the types
This commit is contained in:
		
							parent
							
								
									2cfea600d4
								
							
						
					
					
						commit
						d01cda2815
					
				@ -1,9 +1,9 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require "macos_version"
 | 
			
		||||
 | 
			
		||||
FORMULA_COMPONENT_PRECEDENCE_LIST = [
 | 
			
		||||
FORMULA_COMPONENT_PRECEDENCE_LIST = T.let([
 | 
			
		||||
  [{ name: :include,   type: :method_call }],
 | 
			
		||||
  [{ name: :desc,      type: :method_call }],
 | 
			
		||||
  [{ name: :homepage,  type: :method_call }],
 | 
			
		||||
@ -49,4 +49,4 @@ FORMULA_COMPONENT_PRECEDENCE_LIST = [
 | 
			
		||||
  [{ name: :caveats, type: :method_definition }],
 | 
			
		||||
  [{ name: :plist_options, type: :method_call }, { name: :plist, type: :method_definition }],
 | 
			
		||||
  [{ name: :test, type: :block_call }],
 | 
			
		||||
].freeze
 | 
			
		||||
].freeze, T::Array[[{ name: Symbol, type: Symbol }]])
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
module Cask
 | 
			
		||||
@ -8,7 +8,7 @@ module Cask
 | 
			
		||||
  module Cache
 | 
			
		||||
    sig { returns(Pathname) }
 | 
			
		||||
    def self.path
 | 
			
		||||
      @path ||= HOMEBREW_CACHE/"Cask"
 | 
			
		||||
      @path ||= T.let(HOMEBREW_CACHE/"Cask", T.nilable(Pathname))
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require "fetch"
 | 
			
		||||
@ -59,7 +59,7 @@ module Homebrew
 | 
			
		||||
    formulae_or_casks.each do |formula_or_cask|
 | 
			
		||||
      case formula_or_cask
 | 
			
		||||
      when Formula
 | 
			
		||||
        formula = T.cast(formula_or_cask, Formula)
 | 
			
		||||
        formula = formula_or_cask
 | 
			
		||||
        ref = formula.loaded_from_api? ? formula.full_name : formula.path
 | 
			
		||||
 | 
			
		||||
        os_arch_combinations.each do |os, arch|
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require "cli/parser"
 | 
			
		||||
@ -19,6 +19,7 @@ module Homebrew
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  sig { void }
 | 
			
		||||
  def __repository
 | 
			
		||||
    args = __repository_args.parse
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require "cli/parser"
 | 
			
		||||
@ -24,6 +24,7 @@ module Homebrew
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  sig { void }
 | 
			
		||||
  def analytics
 | 
			
		||||
    args = analytics_args.parse
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,13 +1,12 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require "cleanup"
 | 
			
		||||
require "cli/parser"
 | 
			
		||||
 | 
			
		||||
module Homebrew
 | 
			
		||||
  module_function
 | 
			
		||||
 | 
			
		||||
  def autoremove_args
 | 
			
		||||
  sig { returns(CLI::Parser) }
 | 
			
		||||
  def self.autoremove_args
 | 
			
		||||
    Homebrew::CLI::Parser.new do
 | 
			
		||||
      description <<~EOS
 | 
			
		||||
        Uninstall formulae that were only installed as a dependency of another formula and are now no longer needed.
 | 
			
		||||
@ -19,7 +18,8 @@ module Homebrew
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def autoremove
 | 
			
		||||
  sig { void }
 | 
			
		||||
  def self.autoremove
 | 
			
		||||
    args = autoremove_args.parse
 | 
			
		||||
 | 
			
		||||
    Cleanup.autoremove(dry_run: args.dry_run?)
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require "cleanup"
 | 
			
		||||
@ -33,6 +33,7 @@ module Homebrew
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  sig { void }
 | 
			
		||||
  def cleanup
 | 
			
		||||
    args = cleanup_args.parse
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require "cli/parser"
 | 
			
		||||
@ -22,6 +22,7 @@ module Homebrew
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  sig { void }
 | 
			
		||||
  def commands
 | 
			
		||||
    args = commands_args.parse
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require "cli/parser"
 | 
			
		||||
@ -25,6 +25,7 @@ module Homebrew
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  sig { void }
 | 
			
		||||
  def completions
 | 
			
		||||
    args = completions_args.parse
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require "system_config"
 | 
			
		||||
@ -19,6 +19,7 @@ module Homebrew
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  sig { void }
 | 
			
		||||
  def config
 | 
			
		||||
    config_args.parse
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require "cli/parser"
 | 
			
		||||
 | 
			
		||||
@ -1,9 +1,10 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require "help"
 | 
			
		||||
 | 
			
		||||
module Homebrew
 | 
			
		||||
  sig { returns(T.noreturn) }
 | 
			
		||||
  def help
 | 
			
		||||
    Help.help
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
module Homebrew
 | 
			
		||||
  DEFAULT_PREFIX = ENV.fetch("HOMEBREW_DEFAULT_PREFIX").freeze
 | 
			
		||||
  DEFAULT_REPOSITORY = ENV.fetch("HOMEBREW_DEFAULT_REPOSITORY").freeze
 | 
			
		||||
  DEFAULT_PREFIX = T.let(ENV.fetch("HOMEBREW_DEFAULT_PREFIX").freeze, String)
 | 
			
		||||
  DEFAULT_REPOSITORY = T.let(ENV.fetch("HOMEBREW_DEFAULT_REPOSITORY").freeze, String)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -1,11 +1,13 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
module Cachable
 | 
			
		||||
  sig { returns(T::Hash[T.untyped, T.untyped]) }
 | 
			
		||||
  def cache
 | 
			
		||||
    @cache ||= {}
 | 
			
		||||
    @cache ||= T.let({}, T.nilable(T::Hash[T.untyped, T.untyped]))
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  sig { void }
 | 
			
		||||
  def clear_cache
 | 
			
		||||
    cache.clear
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
if OS.mac?
 | 
			
		||||
 | 
			
		||||
@ -1,10 +1,11 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
module Homebrew
 | 
			
		||||
  class << self
 | 
			
		||||
    alias generic_git_tags git_tags
 | 
			
		||||
 | 
			
		||||
    sig { returns(String) }
 | 
			
		||||
    def git_tags
 | 
			
		||||
      tags = generic_git_tags
 | 
			
		||||
      tags = Utils.popen_read("git tag --list | sort -rV") if tags.blank?
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require "extend/os/linux/parser" if OS.linux?
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,8 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
module Predicable
 | 
			
		||||
  sig { params(attrs: Symbol).void }
 | 
			
		||||
  def attr_predicate(*attrs)
 | 
			
		||||
    attrs.each do |attr|
 | 
			
		||||
      define_method attr do
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require "socket"
 | 
			
		||||
@ -10,6 +10,7 @@ module Homebrew
 | 
			
		||||
  module FreePort
 | 
			
		||||
    # Returns a free port.
 | 
			
		||||
    # @api public
 | 
			
		||||
    sig { returns(Integer) }
 | 
			
		||||
    def free_port
 | 
			
		||||
      server = TCPServer.new 0
 | 
			
		||||
      _, port, = server.addr
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
module Homebrew
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
module Homebrew
 | 
			
		||||
 | 
			
		||||
@ -1,17 +1,20 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
# Match taps' formulae, e.g. `someuser/sometap/someformula`
 | 
			
		||||
HOMEBREW_TAP_FORMULA_REGEX = %r{^([\w-]+)/([\w-]+)/([\w+-.@]+)$}.freeze
 | 
			
		||||
HOMEBREW_TAP_FORMULA_REGEX = T.let(%r{^([\w-]+)/([\w-]+)/([\w+-.@]+)$}.freeze, Regexp)
 | 
			
		||||
# Match taps' casks, e.g. `someuser/sometap/somecask`
 | 
			
		||||
HOMEBREW_TAP_CASK_REGEX = %r{^([\w-]+)/([\w-]+)/([a-z0-9\-_]+)$}.freeze
 | 
			
		||||
HOMEBREW_TAP_CASK_REGEX = T.let(%r{^([\w-]+)/([\w-]+)/([a-z0-9\-_]+)$}.freeze, Regexp)
 | 
			
		||||
# Match main cask taps' casks, e.g. `homebrew/cask/somecask` or `somecask`
 | 
			
		||||
HOMEBREW_MAIN_TAP_CASK_REGEX = %r{^([Hh]omebrew/(?:homebrew-)?cask/)?[a-z0-9\-_]+$}.freeze
 | 
			
		||||
HOMEBREW_MAIN_TAP_CASK_REGEX = T.let(%r{^([Hh]omebrew/(?:homebrew-)?cask/)?[a-z0-9\-_]+$}.freeze, Regexp)
 | 
			
		||||
# Match taps' directory paths, e.g. `HOMEBREW_LIBRARY/Taps/someuser/sometap`
 | 
			
		||||
HOMEBREW_TAP_DIR_REGEX = %r{#{Regexp.escape(HOMEBREW_LIBRARY.to_s)}/Taps/(?<user>[\w-]+)/(?<repo>[\w-]+)}.freeze
 | 
			
		||||
HOMEBREW_TAP_DIR_REGEX = T.let(
 | 
			
		||||
  %r{#{Regexp.escape(HOMEBREW_LIBRARY.to_s)}/Taps/(?<user>[\w-]+)/(?<repo>[\w-]+)}.freeze, Regexp
 | 
			
		||||
)
 | 
			
		||||
# Match taps' formula paths, e.g. `HOMEBREW_LIBRARY/Taps/someuser/sometap/someformula`
 | 
			
		||||
HOMEBREW_TAP_PATH_REGEX = Regexp.new(HOMEBREW_TAP_DIR_REGEX.source + %r{(?:/.*)?$}.source).freeze
 | 
			
		||||
HOMEBREW_TAP_PATH_REGEX = T.let(Regexp.new(HOMEBREW_TAP_DIR_REGEX.source + %r{(?:/.*)?$}.source).freeze, Regexp)
 | 
			
		||||
# Match official taps' casks, e.g. `homebrew/cask/somecask or homebrew/cask-versions/somecask`
 | 
			
		||||
HOMEBREW_CASK_TAP_CASK_REGEX =
 | 
			
		||||
  %r{^(?:([Cc]askroom)/(cask|versions)|([Hh]omebrew)/(?:homebrew-)?(cask|cask-[\w-]+))/([\w+-.]+)$}.freeze
 | 
			
		||||
HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX = /^(home|linux)brew-/.freeze
 | 
			
		||||
  T.let(%r{^(?:([Cc]askroom)/(cask|versions)|([Hh]omebrew)/(?:homebrew-)?(cask|cask-[\w-]+))/([\w+-.]+)$}.freeze,
 | 
			
		||||
        Regexp)
 | 
			
		||||
HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX = T.let(/^(home|linux)brew-/.freeze, Regexp)
 | 
			
		||||
 | 
			
		||||
@ -1,8 +1,8 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
module Homebrew
 | 
			
		||||
  # For testing's sake always assume the default prefix
 | 
			
		||||
  DEFAULT_PREFIX = HOMEBREW_PREFIX.to_s.freeze
 | 
			
		||||
  DEFAULT_REPOSITORY = HOMEBREW_REPOSITORY.to_s.freeze
 | 
			
		||||
  DEFAULT_PREFIX = T.let(HOMEBREW_PREFIX.to_s.freeze, String)
 | 
			
		||||
  DEFAULT_REPOSITORY = T.let(HOMEBREW_REPOSITORY.to_s.freeze, String)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require "utils/repology"
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
#!/usr/bin/env ruby
 | 
			
		||||
# typed: true
 | 
			
		||||
# typed: strict
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require_relative "../standalone"
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user