Migrate Parlour extensions to Tapioca compilers

This commit is contained in:
Douglas Eichelberger 2024-10-14 10:50:57 -07:00
parent f957e0e9fa
commit ced4a3a91f
70 changed files with 1131 additions and 3724 deletions

View File

@ -18,7 +18,6 @@ AllCops:
- "**/*.rbi"
Exclude:
- "Homebrew/sorbet/rbi/{dsl,gems}/**/*.rbi"
- "Homebrew/sorbet/rbi/parlour.rbi"
- "Homebrew/bin/*"
- "Homebrew/vendor/**/*"
- "Taps/*/*/vendor/**/*"

View File

@ -1,10 +0,0 @@
parser: false
output_file:
rbi: sorbet/rbi/parlour.rbi
relative_requires:
- sorbet/parlour.rb
plugins:
Attr: {}

View File

@ -62,7 +62,6 @@ group :tests, optional: true do
end
group :typecheck, optional: true do
gem "method_source", require: false
gem "parlour", require: false
gem "sorbet-static-and-runtime", require: false
gem "spoom", require: false
gem "tapioca", require: false

View File

@ -7,8 +7,6 @@ GEM
bigdecimal (3.1.8)
bindata (2.5.0)
coderay (1.1.3)
commander (5.0.0)
highline (~> 3.0.0)
concurrent-ruby (1.3.4)
diff-lcs (1.5.1)
docile (1.4.1)
@ -16,7 +14,6 @@ GEM
bindata (~> 2)
erubi (1.13.0)
hana (1.3.7)
highline (3.0.1)
json (2.7.2)
json_schemer (2.3.0)
bigdecimal
@ -33,11 +30,6 @@ GEM
parallel (1.26.3)
parallel_tests (4.7.2)
parallel
parlour (9.0.0)
commander (~> 5.0)
parser
rainbow (~> 3.0)
sorbet-runtime (>= 0.5)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
@ -167,7 +159,6 @@ DEPENDENCIES
method_source
minitest
parallel_tests
parlour
patchelf
plist
pry

View File

@ -1,6 +1,10 @@
# typed: strict
# frozen_string_literal: true
# This module provides methods to define specialized attributes.
# Method stubs are generated by the {Tapioca::Compilers::Attrables} compiler.
# @note The compiler is fragile, and must be updated if the filename changes, if methods are added or removed,
# or if a method's arity changes.
module Attrable
extend T::Helpers

View File

@ -12,7 +12,6 @@ module Cask
abstract!
include Comparable
extend Attrable
def self.english_name
@english_name ||= T.must(name).sub(/^.*:/, "").gsub(/(.)([A-Z])/, '\1 \2')

View File

@ -6,7 +6,7 @@ require "utils/curl"
module Cask
# Class corresponding to the `url` stanza.
class URL < Delegator
class URL < SimpleDelegator
class DSL
attr_reader :uri, :tag, :branch, :revisions, :revision,
:trust_cert, :cookies, :header, :data, :only_path
@ -278,12 +278,6 @@ module Cask
private
def __getobj__ = @dsl
def __setobj__(dsl)
@dsl = dsl
end
sig { returns(T.nilable(String)) }
def raw_url_line
return @raw_url_line if defined?(@raw_url_line)

View File

@ -7,7 +7,6 @@ require "dependable"
#
# @api internal
class Dependency
extend Forwardable
include Dependable
extend Cachable

View File

@ -66,7 +66,6 @@ module Homebrew
ohai "Updating Tapioca RBI files..."
safe_system "bundle", "exec", "tapioca", "gem", *tapioca_args
safe_system "bundle", "exec", "parlour"
if args.suggest_typed?
ohai "Checking if we can bump Sorbet `typed` sigils..."

View File

@ -24,7 +24,6 @@ require "github_packages"
# @abstract Abstract superclass for all download strategies.
class AbstractDownloadStrategy
extend Forwardable
include FileUtils
include Context
include SystemCommand::Mixin

View File

@ -10,7 +10,6 @@ module RuboCop
# @see https://docs.brew.sh/Cask-Cookbook#stanza-order
class StanzaOrder < Base
include IgnoredNode
extend Forwardable
extend AutoCorrector
include CaskHelp

View File

@ -21,7 +21,6 @@ module RuboCop
# ```
class Url < Base
extend AutoCorrector
extend Forwardable
include OnUrlStanza
include UrlHelper

View File

@ -1,43 +0,0 @@
# typed: true # rubocop:todo Sorbet/StrictSigil
# frozen_string_literal: true
require_relative "../extend/module"
require_relative "../warnings"
Warnings.ignore :parser_syntax do
require "parser/current"
end
module Homebrew
# Parlour type signature generator helper class for Homebrew.
module Parlour
ROOT_DIR = T.let(Pathname(T.must(__dir__)).parent.realpath.freeze, Pathname).freeze
sig { returns(T::Array[Parser::AST::Node]) }
def self.ast_list
@ast_list ||= begin
ast_list = []
parser = Parser::CurrentRuby.new
prune_dirs = %w[sorbet shims test vendor].freeze
ROOT_DIR.find do |path|
Find.prune if path.directory? && prune_dirs.any? { |subdir| path == ROOT_DIR/subdir }
Find.prune if path.file? && path.extname != ".rb"
next unless path.file?
buffer = Parser::Source::Buffer.new(path, source: path.read)
parser.reset
ast = parser.parse(buffer)
ast_list << ast if ast
end
ast_list
end
end
end
end
require "parlour"
require_relative "parlour/attr"

View File

@ -1,162 +0,0 @@
# typed: strict
# frozen_string_literal: true
# Parlour type signature generator plugin for Homebrew DSL attributes.
class Attr < Parlour::Plugin
sig { override.params(root: Parlour::RbiGenerator::Namespace).void }
def generate(root)
tree = T.let([], T::Array[T.untyped])
Homebrew::Parlour.ast_list.each do |node|
tree += find_custom_attr(node)
end
process_custom_attr(tree, root)
end
sig { override.returns(T.nilable(String)) }
def strictness
"strict"
end
private
sig { params(node: Parser::AST::Node, list: T::Array[String]).returns(T::Array[String]) }
def traverse_module_name(node, list = [])
parent, name = node.children
list = traverse_module_name(parent, list) if parent
list << name.to_s
list
end
sig { params(node: T.nilable(Parser::AST::Node)).returns(T.nilable(String)) }
def extract_module_name(node)
return if node.nil?
traverse_module_name(node).join("::")
end
sig { params(node: Parser::AST::Node).returns(T::Array[T.untyped]) }
def find_custom_attr(node)
tree = T.let([], T::Array[T.untyped])
children = node.children.dup
if node.type == :begin
children.each do |child|
subtree = find_custom_attr(child)
tree += subtree unless subtree.empty?
end
elsif node.type == :sclass
subtree = find_custom_attr(node.children[1])
return tree if subtree.empty?
tree << [:sclass, subtree]
elsif node.type == :class || node.type == :module
element = []
case node.type
when :class
element << :class
element << extract_module_name(children.shift)
element << extract_module_name(children.shift)
when :module
element << :module
element << extract_module_name(children.shift)
end
body = children.shift
return tree if body.nil?
subtree = find_custom_attr(body)
return tree if subtree.empty?
element << subtree
tree << element
elsif node.type == :send && children.shift.nil?
method_name = children.shift
case method_name
when :attr_rw, :attr_predicate
children.each do |name_node|
tree << [method_name, name_node.children.first.to_s]
end
when :delegate
children.each do |name_node|
name_node.children.each do |pair|
delegated_method = pair.children.first
delegated_methods = if delegated_method.type == :array
delegated_method.children
else
[delegated_method]
end
delegated_methods.each do |delegated_method_sym|
tree << [method_name, delegated_method_sym.children.first.to_s]
end
end
end
end
end
tree
end
ARRAY_METHODS = T.let(["to_a", "to_ary"].freeze, T::Array[String])
HASH_METHODS = T.let(["to_h", "to_hash"].freeze, T::Array[String])
STRING_METHODS = T.let(["to_s", "to_str", "to_json"].freeze, T::Array[String])
sig { params(tree: T::Array[T.untyped], namespace: Parlour::RbiGenerator::Namespace, sclass: T::Boolean).void }
def process_custom_attr(tree, namespace, sclass: false)
tree.each do |node|
type = node.shift
case type
when :sclass
process_custom_attr(node.shift, namespace, sclass: true)
when :class
class_namespace = namespace.create_class(node.shift, superclass: node.shift)
process_custom_attr(node.shift, class_namespace)
when :module
module_namespace = namespace.create_module(node.shift)
process_custom_attr(node.shift, module_namespace)
when :attr_rw
name = node.shift
name = "self.#{name}" if sclass
namespace.create_method(name,
parameters: [
Parlour::RbiGenerator::Parameter.new("arg", type: "T.untyped",
default: "T.unsafe(nil)"),
],
return_type: "T.untyped")
when :attr_predicate
name = node.shift
name = "self.#{name}" if sclass
namespace.create_method(name, return_type: "T::Boolean")
when :delegate
name = node.shift
return_type = if name.end_with?("?")
"T::Boolean"
elsif ARRAY_METHODS.include?(name)
"Array"
elsif HASH_METHODS.include?(name)
"Hash"
elsif STRING_METHODS.include?(name)
"String"
else
"T.untyped"
end
name = "self.#{name}" if sclass
namespace.create_method(
name,
parameters: [
Parlour::RbiGenerator::Parameter.new("*args"),
Parlour::RbiGenerator::Parameter.new("**options"),
Parlour::RbiGenerator::Parameter.new("&block"),
],
return_type:,
)
else
raise "Malformed tree."
end
end
end
end

View File

@ -0,0 +1,8 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `ArchRequirement`.
# Please instead update this file by running `bin/tapioca dsl ArchRequirement`.
class ArchRequirement; end

View File

@ -0,0 +1,20 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Bottle`.
# Please instead update this file by running `bin/tapioca dsl Bottle`.
class Bottle
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def cached_download(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def downloader(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def url(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def verify_download_integrity(*args, &block); end
end

View File

@ -0,0 +1,11 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `BottleSpecification`.
# Please instead update this file by running `bin/tapioca dsl BottleSpecification`.
class BottleSpecification
sig { params(arg: T.untyped).returns(T.untyped) }
def rebuild(arg = nil); end
end

View File

@ -0,0 +1,23 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Cask::Audit`.
# Please instead update this file by running `bin/tapioca dsl Cask::Audit`.
class Cask::Audit
sig { returns(T::Boolean) }
def new_cask?; end
sig { returns(T::Boolean) }
def online?; end
sig { returns(T::Boolean) }
def signing?; end
sig { returns(T::Boolean) }
def strict?; end
sig { returns(T::Boolean) }
def token_conflicts?; end
end

View File

@ -0,0 +1,11 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Cask::Cask`.
# Please instead update this file by running `bin/tapioca dsl Cask::Cask`.
class Cask::Cask
sig { returns(T::Boolean) }
def loaded_from_api?; end
end

View File

@ -0,0 +1,23 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Cask::DSL`.
# Please instead update this file by running `bin/tapioca dsl Cask::DSL`.
class Cask::DSL
sig { returns(T::Boolean) }
def depends_on_set_in_block?; end
sig { returns(T::Boolean) }
def deprecated?; end
sig { returns(T::Boolean) }
def disabled?; end
sig { returns(T::Boolean) }
def livecheckable?; end
sig { returns(T::Boolean) }
def on_system_blocks_exist?; end
end

View File

@ -0,0 +1,29 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Cask::DSL::Base`.
# Please instead update this file by running `bin/tapioca dsl Cask::DSL::Base`.
class Cask::DSL::Base
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def appdir(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def arch(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def caskroom_path(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def language(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def staged_path(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def token(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def version(*args, &block); end
end

View File

@ -0,0 +1,11 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Cask::DSL::Caveats`.
# Please instead update this file by running `bin/tapioca dsl Cask::DSL::Caveats`.
class Cask::DSL::Caveats
sig { returns(T::Boolean) }
def discontinued?; end
end

View File

@ -0,0 +1,8 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Cask::DSL::Postflight`.
# Please instead update this file by running `bin/tapioca dsl Cask::DSL::Postflight`.
class Cask::DSL::Postflight; end

View File

@ -0,0 +1,8 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Cask::DSL::Preflight`.
# Please instead update this file by running `bin/tapioca dsl Cask::DSL::Preflight`.
class Cask::DSL::Preflight; end

View File

@ -0,0 +1,8 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Cask::DSL::UninstallPostflight`.
# Please instead update this file by running `bin/tapioca dsl Cask::DSL::UninstallPostflight`.
class Cask::DSL::UninstallPostflight; end

View File

@ -0,0 +1,8 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Cask::DSL::UninstallPreflight`.
# Please instead update this file by running `bin/tapioca dsl Cask::DSL::UninstallPreflight`.
class Cask::DSL::UninstallPreflight; end

View File

@ -0,0 +1,47 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Cask::Installer`.
# Please instead update this file by running `bin/tapioca dsl Cask::Installer`.
class Cask::Installer
sig { returns(T::Boolean) }
def adopt?; end
sig { returns(T::Boolean) }
def binaries?; end
sig { returns(T::Boolean) }
def force?; end
sig { returns(T::Boolean) }
def installed_as_dependency?; end
sig { returns(T::Boolean) }
def installed_on_request?; end
sig { returns(T::Boolean) }
def quarantine?; end
sig { returns(T::Boolean) }
def quiet?; end
sig { returns(T::Boolean) }
def reinstall?; end
sig { returns(T::Boolean) }
def require_sha?; end
sig { returns(T::Boolean) }
def skip_cask_deps?; end
sig { returns(T::Boolean) }
def upgrade?; end
sig { returns(T::Boolean) }
def verbose?; end
sig { returns(T::Boolean) }
def zap?; end
end

View File

@ -0,0 +1,17 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Cask::URL::DSL`.
# Please instead update this file by running `bin/tapioca dsl Cask::URL::DSL`.
class Cask::URL::DSL
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def path(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def scheme(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(String) }
def to_s(*args, &block); end
end

View File

@ -0,0 +1,14 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Caveats`.
# Please instead update this file by running `bin/tapioca dsl Caveats`.
class Caveats
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def empty?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(String) }
def to_s(*args, &block); end
end

View File

@ -0,0 +1,20 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Checksum`.
# Please instead update this file by running `bin/tapioca dsl Checksum`.
class Checksum
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def [](*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def empty?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def length(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(String) }
def to_s(*args, &block); end
end

View File

@ -0,0 +1,8 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `CodesignRequirement`.
# Please instead update this file by running `bin/tapioca dsl CodesignRequirement`.
class CodesignRequirement; end

View File

@ -0,0 +1,13 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Debrew`.
# Please instead update this file by running `bin/tapioca dsl Debrew`.
module Debrew
class << self
sig { returns(T::Boolean) }
def active?; end
end
end

View File

@ -0,0 +1,29 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `ExternalPatch`.
# Please instead update this file by running `bin/tapioca dsl ExternalPatch`.
class ExternalPatch
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def cached_download(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def clear_cache(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def downloaded?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def fetch(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def patch_files(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def url(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def verify_download_integrity(*args, &block); end
end

View File

@ -0,0 +1,154 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Formula`.
# Please instead update this file by running `bin/tapioca dsl Formula`.
class Formula
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def allow_network_access!(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def bottle_defined?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def bottle_specification(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def bottle_tag?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def bottled?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def cached_download(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def clear_cache(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def compiler_failures(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def declared_deps(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def deny_network_access!(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def deprecated?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def deprecated_flags(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def deprecated_options(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def deprecation_date(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def deprecation_reason(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def deps(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def desc(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def disable_date(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def disable_reason(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def disabled?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def downloader(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def env(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def homepage(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def keg_only_reason(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def license(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def livecheck(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def livecheckable?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def loaded_from_api?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def network_access_allowed?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def option_defined?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def options(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def patchlist(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def pin(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def pinnable?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def pinned?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def pinned_version(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def pour_bottle_check_unsatisfied_reason(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def requirements(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def resources(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def service?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def unpin(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def version(*args, &block); end
class << self
sig { params(arg: T.untyped).returns(T.untyped) }
def desc(arg = nil); end
sig { params(arg: T.untyped).returns(T.untyped) }
def homepage(arg = nil); end
sig { returns(T::Boolean) }
def loaded_from_api?; end
sig { returns(T::Boolean) }
def on_system_blocks_exist?; end
sig { params(arg: T.untyped).returns(T.untyped) }
def revision(arg = nil); end
sig { params(arg: T.untyped).returns(T.untyped) }
def version_scheme(arg = nil); end
end
end

View File

@ -0,0 +1,56 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `FormulaInstaller`.
# Please instead update this file by running `bin/tapioca dsl FormulaInstaller`.
class FormulaInstaller
sig { returns(T::Boolean) }
def debug?; end
sig { returns(T::Boolean) }
def debug_symbols?; end
sig { returns(T::Boolean) }
def force?; end
sig { returns(T::Boolean) }
def force_bottle?; end
sig { returns(T::Boolean) }
def git?; end
sig { returns(T::Boolean) }
def ignore_deps?; end
sig { returns(T::Boolean) }
def installed_as_dependency?; end
sig { returns(T::Boolean) }
def installed_on_request?; end
sig { returns(T::Boolean) }
def interactive?; end
sig { returns(T::Boolean) }
def keep_tmp?; end
sig { returns(T::Boolean) }
def only_deps?; end
sig { returns(T::Boolean) }
def overwrite?; end
sig { returns(T::Boolean) }
def quiet?; end
sig { returns(T::Boolean) }
def show_header?; end
sig { returns(T::Boolean) }
def show_summary_heading?; end
sig { returns(T::Boolean) }
def verbose?; end
end

View File

@ -0,0 +1,8 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `HeadSoftwareSpec`.
# Please instead update this file by running `bin/tapioca dsl HeadSoftwareSpec`.
class HeadSoftwareSpec; end

View File

@ -0,0 +1,17 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Homebrew::Cleanup`.
# Please instead update this file by running `bin/tapioca dsl Homebrew::Cleanup`.
class Homebrew::Cleanup
sig { returns(T::Boolean) }
def dry_run?; end
sig { returns(T::Boolean) }
def prune?; end
sig { returns(T::Boolean) }
def scrub?; end
end

View File

@ -0,0 +1,14 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Homebrew::Livecheck::Strategy::ExtractPlist::Item`.
# Please instead update this file by running `bin/tapioca dsl Homebrew::Livecheck::Strategy::ExtractPlist::Item`.
class Homebrew::Livecheck::Strategy::ExtractPlist::Item
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def short_version(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def version(*args, &block); end
end

View File

@ -0,0 +1,17 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Homebrew::Livecheck::Strategy::Sparkle::Item`.
# Please instead update this file by running `bin/tapioca dsl Homebrew::Livecheck::Strategy::Sparkle::Item`.
class Homebrew::Livecheck::Strategy::Sparkle::Item
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def nice_version(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def short_version(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def version(*args, &block); end
end

View File

@ -0,0 +1,35 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Homebrew::Service`.
# Please instead update this file by running `bin/tapioca dsl Homebrew::Service`.
class Homebrew::Service
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def bin(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def etc(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def libexec(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def opt_bin(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def opt_libexec(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def opt_pkgshare(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def opt_prefix(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def opt_sbin(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def var(*args, &block); end
end

41
Library/Homebrew/sorbet/rbi/dsl/keg.rbi generated Normal file
View File

@ -0,0 +1,41 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Keg`.
# Please instead update this file by running `bin/tapioca dsl Keg`.
class Keg
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def /(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def abv(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def directory?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def disk_usage(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def exist?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def file_count(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def find(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def hash(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def join(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def rename(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def to_path(*args, &block); end
end

View File

@ -0,0 +1,8 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `LinuxRequirement`.
# Please instead update this file by running `bin/tapioca dsl LinuxRequirement`.
class LinuxRequirement; end

View File

@ -0,0 +1,8 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Livecheck`.
# Please instead update this file by running `bin/tapioca dsl Livecheck`.
class Livecheck; end

View File

@ -0,0 +1,8 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `MacOSRequirement`.
# Please instead update this file by running `bin/tapioca dsl MacOSRequirement`.
class MacOSRequirement; end

View File

@ -0,0 +1,11 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `MachOShim`.
# Please instead update this file by running `bin/tapioca dsl MachOShim`.
module MachOShim
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def dylib_id(*args, &block); end
end

11
Library/Homebrew/sorbet/rbi/dsl/path.rbi generated Normal file
View File

@ -0,0 +1,11 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `PATH`.
# Please instead update this file by running `bin/tapioca dsl PATH`.
class PATH
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def each(*args, &block); end
end

View File

@ -0,0 +1,23 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `PkgVersion`.
# Please instead update this file by running `bin/tapioca dsl PkgVersion`.
class PkgVersion
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def major(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def major_minor(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def major_minor_patch(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def minor(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def patch(*args, &block); end
end

View File

@ -0,0 +1,19 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Requirement`.
# Please instead update this file by running `bin/tapioca dsl Requirement`.
class Requirement
class << self
sig { params(arg: T.untyped).returns(T.untyped) }
def cask(arg = nil); end
sig { params(arg: T.untyped).returns(T.untyped) }
def download(arg = nil); end
sig { params(arg: T.untyped).returns(T.untyped) }
def fatal(arg = nil); end
end
end

View File

@ -0,0 +1,29 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `ResourceStageContext`.
# Please instead update this file by running `bin/tapioca dsl ResourceStageContext`.
class ResourceStageContext
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def mirrors(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def retain!(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def source_modified_time(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def specs(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def url(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def using(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def version(*args, &block); end
end

View File

@ -0,0 +1,11 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `RuboCop::Cask::AST::CaskBlock`.
# Please instead update this file by running `bin/tapioca dsl RuboCop::Cask::AST::CaskBlock`.
class RuboCop::Cask::AST::CaskBlock
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def cask_body(*args, &block); end
end

View File

@ -0,0 +1,23 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `RuboCop::Cask::AST::Stanza`.
# Please instead update this file by running `bin/tapioca dsl RuboCop::Cask::AST::Stanza`.
class RuboCop::Cask::AST::Stanza
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def arch_variable?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T::Boolean) }
def on_system_block?(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def parent_node(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def source(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def source_with_comments(*args, &block); end
end

View File

@ -0,0 +1,11 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `RuboCop::Cop::Cask::OnDescStanza`.
# Please instead update this file by running `bin/tapioca dsl RuboCop::Cop::Cask::OnDescStanza`.
module RuboCop::Cop::Cask::OnDescStanza
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def toplevel_stanzas(*args, &block); end
end

View File

@ -0,0 +1,11 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `RuboCop::Cop::Cask::OnHomepageStanza`.
# Please instead update this file by running `bin/tapioca dsl RuboCop::Cop::Cask::OnHomepageStanza`.
module RuboCop::Cop::Cask::OnHomepageStanza
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def toplevel_stanzas(*args, &block); end
end

View File

@ -0,0 +1,14 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `RuboCop::Cop::Cask::OnSystemConditionals`.
# Please instead update this file by running `bin/tapioca dsl RuboCop::Cop::Cask::OnSystemConditionals`.
class RuboCop::Cop::Cask::OnSystemConditionals
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def cask_body(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def toplevel_stanzas(*args, &block); end
end

View File

@ -0,0 +1,11 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `RuboCop::Cop::Cask::OnUrlStanza`.
# Please instead update this file by running `bin/tapioca dsl RuboCop::Cop::Cask::OnUrlStanza`.
module RuboCop::Cop::Cask::OnUrlStanza
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def toplevel_stanzas(*args, &block); end
end

View File

@ -0,0 +1,14 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `RuboCop::Cop::Cask::StanzaGrouping`.
# Please instead update this file by running `bin/tapioca dsl RuboCop::Cop::Cask::StanzaGrouping`.
class RuboCop::Cop::Cask::StanzaGrouping
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def cask_node(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def toplevel_stanzas(*args, &block); end
end

View File

@ -6,6 +6,9 @@
class RuboCop::Cop::Cask::Variables
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def cask_node(*args, &block); end
sig do
params(
node: RuboCop::AST::Node,

View File

@ -0,0 +1,53 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `SoftwareSpec`.
# Please instead update this file by running `bin/tapioca dsl SoftwareSpec`.
class SoftwareSpec
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def cached_download(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def checksum(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def clear_cache(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def download_name(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def downloader(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def fetch(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def mirror(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def mirrors(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def sha256(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def source_modified_time(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def specs(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def stage(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def using(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def verify_download_integrity(*args, &block); end
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def version(*args, &block); end
end

View File

@ -0,0 +1,20 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `SystemCommand`.
# Please instead update this file by running `bin/tapioca dsl SystemCommand`.
class SystemCommand
sig { returns(T::Boolean) }
def must_succeed?; end
sig { returns(T::Boolean) }
def reset_uid?; end
sig { returns(T::Boolean) }
def sudo?; end
sig { returns(T::Boolean) }
def sudo_as_root?; end
end

View File

@ -0,0 +1,11 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Utils::AST::FormulaAST`.
# Please instead update this file by running `bin/tapioca dsl Utils::AST::FormulaAST`.
class Utils::AST::FormulaAST
sig { params(args: T.untyped, block: T.untyped).returns(T.untyped) }
def process(*args, &block); end
end

View File

@ -0,0 +1,8 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `XcodeRequirement`.
# Please instead update this file by running `bin/tapioca dsl XcodeRequirement`.
class XcodeRequirement; end

File diff suppressed because it is too large Load Diff

View File

@ -1,420 +0,0 @@
# typed: strict
class PATH
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def each(*args, **options, &block); end
end
class Caveats
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T::Boolean) }
def empty?(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(String) }
def to_s(*args, **options, &block); end
end
class Checksum
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T::Boolean) }
def empty?(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(String) }
def to_s(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def length(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def [](*args, **options, &block); end
end
module Debrew
sig { returns(T::Boolean) }
def self.active?; end
end
class Formula
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T::Boolean) }
def bottle_defined?(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T::Boolean) }
def bottle_tag?(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T::Boolean) }
def bottled?(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def bottle_specification(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def downloader(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def desc(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def license(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def homepage(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def livecheck(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T::Boolean) }
def livecheckable?(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T::Boolean) }
def service?(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def version(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def allow_network_access!(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def deny_network_access!(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T::Boolean) }
def network_access_allowed?(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T::Boolean) }
def loaded_from_api?(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def deps(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def declared_deps(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def requirements(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def cached_download(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def clear_cache(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def options(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def deprecated_options(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def deprecated_flags(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T::Boolean) }
def option_defined?(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def compiler_failures(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def pour_bottle_check_unsatisfied_reason(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def keg_only_reason(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T::Boolean) }
def deprecated?(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def deprecation_date(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def deprecation_reason(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T::Boolean) }
def disabled?(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def disable_date(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def disable_reason(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T::Boolean) }
def pinnable?(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T::Boolean) }
def pinned?(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def pinned_version(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def pin(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def unpin(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def env(*args, **options, &block); end
sig { returns(T::Boolean) }
def self.loaded_from_api?; end
sig { returns(T::Boolean) }
def self.on_system_blocks_exist?; end
sig { params(arg: T.untyped).returns(T.untyped) }
def self.desc(arg = T.unsafe(nil)); end
sig { params(arg: T.untyped).returns(T.untyped) }
def self.homepage(arg = T.unsafe(nil)); end
sig { params(arg: T.untyped).returns(T.untyped) }
def self.revision(arg = T.unsafe(nil)); end
sig { params(arg: T.untyped).returns(T.untyped) }
def self.version_scheme(arg = T.unsafe(nil)); end
end
class FormulaInstaller
sig { returns(T::Boolean) }
def installed_as_dependency?; end
sig { returns(T::Boolean) }
def installed_on_request?; end
sig { returns(T::Boolean) }
def show_summary_heading?; end
sig { returns(T::Boolean) }
def show_header?; end
sig { returns(T::Boolean) }
def force_bottle?; end
sig { returns(T::Boolean) }
def ignore_deps?; end
sig { returns(T::Boolean) }
def only_deps?; end
sig { returns(T::Boolean) }
def interactive?; end
sig { returns(T::Boolean) }
def git?; end
sig { returns(T::Boolean) }
def force?; end
sig { returns(T::Boolean) }
def overwrite?; end
sig { returns(T::Boolean) }
def keep_tmp?; end
sig { returns(T::Boolean) }
def debug_symbols?; end
sig { returns(T::Boolean) }
def verbose?; end
sig { returns(T::Boolean) }
def debug?; end
sig { returns(T::Boolean) }
def quiet?; end
end
class Livecheck
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def version(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def arch(*args, **options, &block); end
end
module MachOShim
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def dylib_id(*args, **options, &block); end
end
class PkgVersion
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def major(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def minor(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def patch(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def major_minor(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def major_minor_patch(*args, **options, &block); end
end
class Requirement
sig { params(arg: T.untyped).returns(T.untyped) }
def self.fatal(arg = T.unsafe(nil)); end
sig { params(arg: T.untyped).returns(T.untyped) }
def self.cask(arg = T.unsafe(nil)); end
sig { params(arg: T.untyped).returns(T.untyped) }
def self.download(arg = T.unsafe(nil)); end
end
class BottleSpecification
sig { params(arg: T.untyped).returns(T.untyped) }
def rebuild(arg = T.unsafe(nil)); end
end
class SystemCommand
sig { returns(T::Boolean) }
def sudo?; end
sig { returns(T::Boolean) }
def sudo_as_root?; end
sig { returns(T::Boolean) }
def must_succeed?; end
sig { returns(T::Boolean) }
def reset_uid?; end
end
module Utils
module AST
class FormulaAST
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def process(*args, **options, &block); end
end
end
end
module Cask
class Audit
sig { returns(T::Boolean) }
def new_cask?; end
sig { returns(T::Boolean) }
def strict?; end
sig { returns(T::Boolean) }
def signing?; end
sig { returns(T::Boolean) }
def online?; end
sig { returns(T::Boolean) }
def token_conflicts?; end
end
class Cask
sig { returns(T::Boolean) }
def loaded_from_api?; end
end
class Installer
sig { returns(T::Boolean) }
def binaries?; end
sig { returns(T::Boolean) }
def force?; end
sig { returns(T::Boolean) }
def adopt?; end
sig { returns(T::Boolean) }
def skip_cask_deps?; end
sig { returns(T::Boolean) }
def require_sha?; end
sig { returns(T::Boolean) }
def reinstall?; end
sig { returns(T::Boolean) }
def upgrade?; end
sig { returns(T::Boolean) }
def verbose?; end
sig { returns(T::Boolean) }
def zap?; end
sig { returns(T::Boolean) }
def installed_as_dependency?; end
sig { returns(T::Boolean) }
def installed_on_request?; end
sig { returns(T::Boolean) }
def quarantine?; end
sig { returns(T::Boolean) }
def quiet?; end
end
class DSL
class Caveats < Base
sig { returns(T::Boolean) }
def discontinued?; end
end
sig { returns(T::Boolean) }
def deprecated?; end
sig { returns(T::Boolean) }
def disabled?; end
sig { returns(T::Boolean) }
def livecheckable?; end
sig { returns(T::Boolean) }
def on_system_blocks_exist?; end
sig { returns(T::Boolean) }
def depends_on_set_in_block?; end
end
end
module Homebrew
class Cleanup
sig { returns(T::Boolean) }
def dry_run?; end
sig { returns(T::Boolean) }
def scrub?; end
sig { returns(T::Boolean) }
def prune?; end
end
class Service
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def bin(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def etc(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def libexec(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def opt_bin(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def opt_libexec(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def opt_pkgshare(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def opt_prefix(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def opt_sbin(*args, **options, &block); end
sig { params(args: T.untyped, options: T.untyped, block: T.untyped).returns(T.untyped) }
def var(*args, **options, &block); end
end
end

View File

@ -0,0 +1,55 @@
# typed: strict
# frozen_string_literal: true
require_relative "../../../global"
require "sorbet/tapioca/utils"
require "debrew"
module Tapioca
module Compilers
class Attrables < Tapioca::Dsl::Compiler
ATTRABLE_FILENAME = "attrable.rb"
ConstantType = type_member { { fixed: Module } }
sig { override.returns(T::Enumerable[Module]) }
def self.gather_constants
ObjectSpace.each_object(Attrable).map { |obj| obj.name.nil? ? obj.attached_object : obj }
end
sig { override.void }
def decorate
root.create_path(constant) do |klass|
Homebrew::Tapioca::Utils.methods_from_file(constant, ATTRABLE_FILENAME)
.each { |method| compile_attrable_method(klass, method) }
Homebrew::Tapioca::Utils.methods_from_file(constant, ATTRABLE_FILENAME, class_methods: true)
.each { |method| compile_attrable_method(klass, method, class_method: true) }
end
end
private
sig { params(klass: RBI::Scope, method: T.any(Method, UnboundMethod), class_method: T::Boolean).void }
def compile_attrable_method(klass, method, class_method: false)
case method.arity
when -1
# attr_rw
klass.create_method(
method.name.to_s,
parameters: [create_opt_param("arg", type: "T.untyped", default: "nil")],
return_type: "T.untyped",
class_method:,
)
when 0
# attr_predicate
klass.create_method(
method.name.to_s,
return_type: "T::Boolean",
class_method:,
)
else
raise "Unsupported arity for method #{method.name} - did `Attrable` change?"
end
end
end
end
end

View File

@ -0,0 +1,79 @@
# typed: strict
# frozen_string_literal: true
require_relative "../../../global"
require "sorbet/tapioca/utils"
require "utils/ast"
module Tapioca
module Compilers
class Forwardables < Tapioca::Dsl::Compiler
FORWARDABLE_FILENAME = "forwardable.rb"
ARRAY_METHODS = T.let(["to_a", "to_ary"].freeze, T::Array[String])
HASH_METHODS = T.let(["to_h", "to_hash"].freeze, T::Array[String])
STRING_METHODS = T.let(["to_s", "to_str", "to_json"].freeze, T::Array[String])
ConstantType = type_member { { fixed: Module } }
sig { override.returns(T::Enumerable[Module]) }
def self.gather_constants
objects = T.cast(ObjectSpace.each_object(Forwardable), T::Enumerator[Module])
objects.map { |obj| named_object(obj) }.uniq.reject do |obj|
# Avoid duplicate stubs for forwardables that are defined in vendored gems
Object.const_source_location(T.must(obj.name))&.first&.include?("vendor/bundle/ruby")
end
end
sig { params(obj: Module).returns(Module) }
def self.named_object(obj)
if obj.is_a?(Class) && obj.name.nil?
T.cast(obj.attached_object, Module)
else
obj
end
end
sig { override.void }
def decorate
root.create_path(constant) do |klass|
Homebrew::Tapioca::Utils.methods_from_file(constant, FORWARDABLE_FILENAME)
.each { |method| compile_forwardable_method(klass, method) }
Homebrew::Tapioca::Utils.methods_from_file(constant, FORWARDABLE_FILENAME, class_methods: true)
.each { |method| compile_forwardable_method(klass, method, class_method: true) }
end
end
private
sig { params(klass: RBI::Scope, method: T.any(Method, UnboundMethod), class_method: T::Boolean).void }
def compile_forwardable_method(klass, method, class_method: false)
name = method.name.to_s
return_type = return_type(name)
klass.create_method(
name,
parameters: [
create_rest_param("args", type: "T.untyped"),
create_block_param("block", type: "T.untyped"),
],
return_type:,
class_method:,
)
end
sig { params(name: String).returns(String) }
def return_type(name)
if name.end_with?("?")
"T::Boolean"
elsif ARRAY_METHODS.include?(name)
"Array"
elsif HASH_METHODS.include?(name)
"Hash"
elsif STRING_METHODS.include?(name)
"String"
else
"T.untyped"
end
end
end
end
end

View File

@ -6,11 +6,9 @@ gem:
- json
# These aren't needed:
- coderay
- commander
- diff-lcs
- docile
- hana
- highline
- language_server-protocol
- netrc
- parallel

View File

@ -0,0 +1,23 @@
# typed: strict
# frozen_string_literal: true
module Homebrew
module Tapioca
module Utils
# @param class_methods [Boolean] whether to get class methods or instance methods
# @return the `module` methods that are defined in the given file
sig {
params(mod: Module, file_name: String,
class_methods: T::Boolean).returns(T::Array[T.any(Method, UnboundMethod)])
}
def self.methods_from_file(mod, file_name, class_methods: false)
methods = if class_methods
mod.methods(false).map { mod.method(_1) }
else
mod.instance_methods(false).map { mod.instance_method(_1) }
end
methods.select { _1.source_location&.first&.end_with?(file_name) }
end
end
end
end

View File

@ -25,7 +25,6 @@ UNDEFINED_CONSTANTS = %w[
Minitest
Nokogiri
OS::Mac::Version
Parlour
PatchELF
Pry
ProgressBar

View File

@ -41,8 +41,6 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/bigdecimal-3.1.8/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/bindata-2.5.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/coderay-1.1.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/highline-3.0.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/commander-5.0.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/diff-lcs-1.5.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/docile-1.4.1/lib")
@ -66,14 +64,13 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/racc-1.8.1")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/racc-1.8.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parser-3.3.5.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rainbow-3.1.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.11602/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parlour-9.0.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/patchelf-1.5.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/plist-3.7.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/prism-1.2.0")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/prism-1.2.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/prism-1.1.0")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/prism-1.1.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/pry-0.14.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rainbow-3.1.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.11602/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbi-0.2.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/rbs-3.6.1")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbs-3.6.1/lib")

View File

@ -44,7 +44,6 @@ There are also a very small number of files that Homebrew loads before sorbet-ru
- `gems`: RBI files for all gems are generated using [Tapioca](https://github.com/Shopify/tapioca#tapioca).
- `dsl`: RBI files autogenerated by our [Tapioca compilers](https://github.com/Homebrew/brew/tree/master/Library/Homebrew/sorbet/tapioca/compilers).
- `parlour.rbi`: RBI files generated by Parlour that have not yet been migrated to Tapioca compilers
- `upstream.rbi`: This file is not auto-generated and is a manually written file that contains temporary workarounds for upstream Sorbet issues. This file is typically empty.
- The `config` file is a newline-separated list of arguments to pass to `srb tc`, the same as if theyd been passed on the command line. Arguments in the config file are always passed first, followed by arguments provided on the command line. We use it to ignore Gem directories which we do not wish to type check.