Merge pull request #15006 from dduugg/brew-types

Enable typing in Library/Homebrew/brew.rb
This commit is contained in:
Mike McQuaid 2023-03-19 00:33:42 -04:00 committed by GitHub
commit 26914e2469
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 97 additions and 6 deletions

View File

@ -28,6 +28,7 @@ gem "rubocop", require: false
gem "rubocop-ast", require: false
gem "simplecov", require: false
gem "simplecov-cobertura", require: false
gem "stackprof", require: false
gem "warning", require: false
group :sorbet, optional: true do

View File

@ -188,6 +188,7 @@ GEM
sorbet (>= 0.5.9204)
sorbet-runtime (>= 0.5.9204)
thor (>= 0.19.2)
stackprof (0.2.23)
tapioca (0.7.3)
bundler (>= 1.17.3)
pry (>= 0.12.2)
@ -257,6 +258,7 @@ DEPENDENCIES
sorbet-runtime
sorbet-static-and-runtime
spoom
stackprof
tapioca
warning

View File

@ -1,6 +1,7 @@
# typed: false
# typed: true
# frozen_string_literal: true
# `HOMEBREW_STACKPROF` should be set via `brew prof --stackprof`, not manually.
if ENV["HOMEBREW_STACKPROF"]
require "rubygems"
require "stackprof"
@ -35,8 +36,8 @@ begin
empty_argv = ARGV.empty?
help_flag_list = %w[-h --help --usage -?]
help_flag = !ENV["HOMEBREW_HELP"].nil?
help_cmd_index = nil
cmd = nil
help_cmd_index = T.let(nil, T.nilable(Integer))
cmd = T.let(nil, T.nilable(String))
ARGV.each_with_index do |arg, i|
break if help_flag && cmd
@ -64,7 +65,7 @@ begin
path.prepend(HOMEBREW_SHIMS_PATH/"shared")
homebrew_path.prepend(HOMEBREW_SHIMS_PATH/"shared")
ENV["PATH"] = path
ENV["PATH"] = path.to_s
require "commands"
require "settings"
@ -76,7 +77,7 @@ begin
homebrew_path.append(Tap.cmd_directories)
# External commands expect a normal PATH
ENV["PATH"] = homebrew_path
ENV["PATH"] = homebrew_path.to_s
end
# Usage instructions should be displayed if and only if one of:

View File

@ -0,0 +1,88 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `stackprof` gem.
# Please instead update this file by running `bin/tapioca gem stackprof`.
module StackProf
class << self
def results(*_arg0); end
def run(*_arg0); end
def running?; end
def sample; end
def start(*_arg0); end
def stop; end
def use_postponed_job!; end
end
end
class StackProf::Middleware
def initialize(app, options = T.unsafe(nil)); end
def call(env); end
class << self
def enabled; end
def enabled=(_arg0); end
def enabled?(env); end
def interval; end
def interval=(_arg0); end
def metadata; end
def metadata=(_arg0); end
def mode; end
def mode=(_arg0); end
def path; end
def path=(_arg0); end
def raw; end
def raw=(_arg0); end
def save; end
end
end
class StackProf::Report
def initialize(data); end
def +(other); end
def add_lines(a, b); end
def convert_to_d3_flame_graph_format(name, stacks, depth); end
def data; end
def files; end
def flamegraph_row(f, x, y, weight, addr); end
def flamegraph_stacks(raw); end
def frames(sort_by_total = T.unsafe(nil)); end
def max_samples; end
def modeline; end
def normalized_frames; end
def overall_samples; end
def print_alphabetical_flamegraph(f = T.unsafe(nil), skip_common = T.unsafe(nil)); end
def print_callgrind(f = T.unsafe(nil)); end
def print_d3_flamegraph(f = T.unsafe(nil), skip_common = T.unsafe(nil)); end
def print_debug; end
def print_dump(f = T.unsafe(nil)); end
def print_file(filter, f = T.unsafe(nil)); end
def print_files(sort_by_total = T.unsafe(nil), limit = T.unsafe(nil), f = T.unsafe(nil)); end
def print_flamegraph(f, skip_common, alphabetical = T.unsafe(nil)); end
def print_graphviz(options = T.unsafe(nil), f = T.unsafe(nil)); end
def print_json(f = T.unsafe(nil)); end
def print_method(name, f = T.unsafe(nil)); end
def print_stackcollapse; end
def print_text(sort_by_total = T.unsafe(nil), limit = T.unsafe(nil), select_files = T.unsafe(nil), reject_files = T.unsafe(nil), select_names = T.unsafe(nil), reject_names = T.unsafe(nil), f = T.unsafe(nil)); end
def print_timeline_flamegraph(f = T.unsafe(nil), skip_common = T.unsafe(nil)); end
def version; end
def walk_method(name); end
private
def callers_for(addr); end
def root_frames; end
def source_display(f, file, lines, range = T.unsafe(nil)); end
class << self
def from_file(file); end
def from_json(json); end
def parse_json(json); end
end
end
StackProf::Report::MARSHAL_SIGNATURE = T.let(T.unsafe(nil), String)
StackProf::VERSION = T.let(T.unsafe(nil), String)

View File

@ -4,7 +4,6 @@
# typed: false
module ::StackProf; end
module T::InterfaceWrapper::Helpers; end
module T::Private::Abstract::Hooks; end
module T::Private::Methods::MethodHooks; end