From 6dc20d253a4ef3a34d20340008dbbdd32e4ef5db Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Sat, 18 Mar 2023 13:46:13 -0700 Subject: [PATCH 1/4] Add stackprof@0.2.23.rbi --- .../Homebrew/sorbet/rbi/stackprof@0.2.23.rbi | 241 ++++++++++++++++++ 1 file changed, 241 insertions(+) create mode 100644 Library/Homebrew/sorbet/rbi/stackprof@0.2.23.rbi diff --git a/Library/Homebrew/sorbet/rbi/stackprof@0.2.23.rbi b/Library/Homebrew/sorbet/rbi/stackprof@0.2.23.rbi new file mode 100644 index 0000000000..f6b07cc2d5 --- /dev/null +++ b/Library/Homebrew/sorbet/rbi/stackprof@0.2.23.rbi @@ -0,0 +1,241 @@ +# 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`. + +# source://stackprof//lib/stackprof.rb#11 +module StackProf + class << self + def results(*_arg0); end + def run(*_arg0); end + + # @return [Boolean] + def running?; end + + def sample; end + def start(*_arg0); end + def stop; end + def use_postponed_job!; end + end +end + +# source://stackprof//lib/stackprof/middleware.rb#4 +class StackProf::Middleware + # @return [Middleware] a new instance of Middleware + # + # source://stackprof//lib/stackprof/middleware.rb#5 + def initialize(app, options = T.unsafe(nil)); end + + # source://stackprof//lib/stackprof/middleware.rb#20 + def call(env); end + + class << self + # Returns the value of attribute enabled. + # + # source://stackprof//lib/stackprof/middleware.rb#40 + def enabled; end + + # Sets the attribute enabled + # + # @param value the value to set the attribute enabled to. + # + # source://stackprof//lib/stackprof/middleware.rb#40 + def enabled=(_arg0); end + + # @return [Boolean] + # + # source://stackprof//lib/stackprof/middleware.rb#42 + def enabled?(env); end + + # Returns the value of attribute interval. + # + # source://stackprof//lib/stackprof/middleware.rb#40 + def interval; end + + # Sets the attribute interval + # + # @param value the value to set the attribute interval to. + # + # source://stackprof//lib/stackprof/middleware.rb#40 + def interval=(_arg0); end + + # Returns the value of attribute metadata. + # + # source://stackprof//lib/stackprof/middleware.rb#40 + def metadata; end + + # Sets the attribute metadata + # + # @param value the value to set the attribute metadata to. + # + # source://stackprof//lib/stackprof/middleware.rb#40 + def metadata=(_arg0); end + + # Returns the value of attribute mode. + # + # source://stackprof//lib/stackprof/middleware.rb#40 + def mode; end + + # Sets the attribute mode + # + # @param value the value to set the attribute mode to. + # + # source://stackprof//lib/stackprof/middleware.rb#40 + def mode=(_arg0); end + + # Returns the value of attribute path. + # + # source://stackprof//lib/stackprof/middleware.rb#40 + def path; end + + # Sets the attribute path + # + # @param value the value to set the attribute path to. + # + # source://stackprof//lib/stackprof/middleware.rb#40 + def path=(_arg0); end + + # Returns the value of attribute raw. + # + # source://stackprof//lib/stackprof/middleware.rb#40 + def raw; end + + # Sets the attribute raw + # + # @param value the value to set the attribute raw to. + # + # source://stackprof//lib/stackprof/middleware.rb#40 + def raw=(_arg0); end + + # source://stackprof//lib/stackprof/middleware.rb#50 + def save; end + end +end + +# source://stackprof//lib/stackprof/report.rb#8 +class StackProf::Report + # @return [Report] a new instance of Report + # + # source://stackprof//lib/stackprof/report.rb#42 + def initialize(data); end + + # @raise [ArgumentError] + # + # source://stackprof//lib/stackprof/report.rb#618 + def +(other); end + + # source://stackprof//lib/stackprof/report.rb#92 + def add_lines(a, b); end + + # source://stackprof//lib/stackprof/report.rb#212 + def convert_to_d3_flame_graph_format(name, stacks, depth); end + + # Returns the value of attribute data. + # + # source://stackprof//lib/stackprof/report.rb#45 + def data; end + + # source://stackprof//lib/stackprof/report.rb#80 + def files; end + + # source://stackprof//lib/stackprof/report.rb#205 + def flamegraph_row(f, x, y, weight, addr); end + + # source://stackprof//lib/stackprof/report.rb#187 + def flamegraph_stacks(raw); end + + # source://stackprof//lib/stackprof/report.rb#47 + def frames(sort_by_total = T.unsafe(nil)); end + + # source://stackprof//lib/stackprof/report.rb#76 + def max_samples; end + + # source://stackprof//lib/stackprof/report.rb#68 + def modeline; end + + # source://stackprof//lib/stackprof/report.rb#52 + def normalized_frames; end + + # source://stackprof//lib/stackprof/report.rb#72 + def overall_samples; end + + # source://stackprof//lib/stackprof/report.rb#128 + def print_alphabetical_flamegraph(f = T.unsafe(nil), skip_common = T.unsafe(nil)); end + + # source://stackprof//lib/stackprof/report.rb#495 + def print_callgrind(f = T.unsafe(nil)); end + + # source://stackprof//lib/stackprof/report.rb#242 + def print_d3_flamegraph(f = T.unsafe(nil), skip_common = T.unsafe(nil)); end + + # source://stackprof//lib/stackprof/report.rb#99 + def print_debug; end + + # source://stackprof//lib/stackprof/report.rb#103 + def print_dump(f = T.unsafe(nil)); end + + # source://stackprof//lib/stackprof/report.rb#610 + def print_file(filter, f = T.unsafe(nil)); end + + # source://stackprof//lib/stackprof/report.rb#600 + def print_files(sort_by_total = T.unsafe(nil), limit = T.unsafe(nil), f = T.unsafe(nil)); end + + # source://stackprof//lib/stackprof/report.rb#132 + def print_flamegraph(f, skip_common, alphabetical = T.unsafe(nil)); end + + # source://stackprof//lib/stackprof/report.rb#414 + def print_graphviz(options = T.unsafe(nil), f = T.unsafe(nil)); end + + # source://stackprof//lib/stackprof/report.rb#107 + def print_json(f = T.unsafe(nil)); end + + # source://stackprof//lib/stackprof/report.rb#526 + def print_method(name, f = T.unsafe(nil)); end + + # source://stackprof//lib/stackprof/report.rb#112 + def print_stackcollapse; end + + # source://stackprof//lib/stackprof/report.rb#476 + 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 + + # source://stackprof//lib/stackprof/report.rb#124 + def print_timeline_flamegraph(f = T.unsafe(nil), skip_common = T.unsafe(nil)); end + + # source://stackprof//lib/stackprof/report.rb#64 + def version; end + + # Walk up and down the stack from a given starting point (name). Loops + # until `:exit` is selected + # + # source://stackprof//lib/stackprof/report.rb#561 + def walk_method(name); end + + private + + # source://stackprof//lib/stackprof/report.rb#669 + def callers_for(addr); end + + # source://stackprof//lib/stackprof/report.rb#665 + def root_frames; end + + # source://stackprof//lib/stackprof/report.rb#674 + def source_display(f, file, lines, range = T.unsafe(nil)); end + + class << self + # source://stackprof//lib/stackprof/report.rb#12 + def from_file(file); end + + # source://stackprof//lib/stackprof/report.rb#20 + def from_json(json); end + + # source://stackprof//lib/stackprof/report.rb#24 + def parse_json(json); end + end +end + +# source://stackprof//lib/stackprof/report.rb#9 +StackProf::Report::MARSHAL_SIGNATURE = T.let(T.unsafe(nil), String) + +# source://stackprof//lib/stackprof.rb#12 +StackProf::VERSION = T.let(T.unsafe(nil), String) From 2969cdb5c199123e29ecf92a208c60977acc98ef Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Sat, 18 Mar 2023 13:55:19 -0700 Subject: [PATCH 2/4] Enable types in brew.rb --- Library/Homebrew/brew.rb | 11 ++++++----- Library/Homebrew/sorbet/rbi/stackprof@0.2.23.rbi | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 76f653aad4..6f185bc216 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -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: diff --git a/Library/Homebrew/sorbet/rbi/stackprof@0.2.23.rbi b/Library/Homebrew/sorbet/rbi/stackprof@0.2.23.rbi index f6b07cc2d5..b0d22b7d39 100644 --- a/Library/Homebrew/sorbet/rbi/stackprof@0.2.23.rbi +++ b/Library/Homebrew/sorbet/rbi/stackprof@0.2.23.rbi @@ -4,6 +4,8 @@ # This is an autogenerated file for types exported from the `stackprof` gem. # Please instead update this file by running `bin/tapioca gem stackprof`. +# Note that since `stackprof` is not managed in a `Gemfile`, we can't put this in the `sorbet/rbi/gems` folder. + # source://stackprof//lib/stackprof.rb#11 module StackProf class << self From 6415ae673908a16754af5b771e58bccf041ae45c Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Sat, 18 Mar 2023 16:23:08 -0700 Subject: [PATCH 3/4] Add stackprof to Gemfile --- Library/Homebrew/Gemfile | 1 + Library/Homebrew/Gemfile.lock | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Library/Homebrew/Gemfile b/Library/Homebrew/Gemfile index 1a5f5d8383..79cb2bcdaa 100644 --- a/Library/Homebrew/Gemfile +++ b/Library/Homebrew/Gemfile @@ -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 diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index 37c6a02ec4..7a0e437a2d 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -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 From aea54a9ceb6f35d10bcd359a279dc5680358d993 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Sat, 18 Mar 2023 16:29:12 -0700 Subject: [PATCH 4/4] Generate RBI for StackProf --- .../sorbet/rbi/gems/stackprof@0.2.23.rbi | 88 +++++++ .../Homebrew/sorbet/rbi/stackprof@0.2.23.rbi | 243 ------------------ Library/Homebrew/sorbet/rbi/todo.rbi | 1 - 3 files changed, 88 insertions(+), 244 deletions(-) create mode 100644 Library/Homebrew/sorbet/rbi/gems/stackprof@0.2.23.rbi delete mode 100644 Library/Homebrew/sorbet/rbi/stackprof@0.2.23.rbi diff --git a/Library/Homebrew/sorbet/rbi/gems/stackprof@0.2.23.rbi b/Library/Homebrew/sorbet/rbi/gems/stackprof@0.2.23.rbi new file mode 100644 index 0000000000..c60dde1735 --- /dev/null +++ b/Library/Homebrew/sorbet/rbi/gems/stackprof@0.2.23.rbi @@ -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) diff --git a/Library/Homebrew/sorbet/rbi/stackprof@0.2.23.rbi b/Library/Homebrew/sorbet/rbi/stackprof@0.2.23.rbi deleted file mode 100644 index b0d22b7d39..0000000000 --- a/Library/Homebrew/sorbet/rbi/stackprof@0.2.23.rbi +++ /dev/null @@ -1,243 +0,0 @@ -# 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`. - -# Note that since `stackprof` is not managed in a `Gemfile`, we can't put this in the `sorbet/rbi/gems` folder. - -# source://stackprof//lib/stackprof.rb#11 -module StackProf - class << self - def results(*_arg0); end - def run(*_arg0); end - - # @return [Boolean] - def running?; end - - def sample; end - def start(*_arg0); end - def stop; end - def use_postponed_job!; end - end -end - -# source://stackprof//lib/stackprof/middleware.rb#4 -class StackProf::Middleware - # @return [Middleware] a new instance of Middleware - # - # source://stackprof//lib/stackprof/middleware.rb#5 - def initialize(app, options = T.unsafe(nil)); end - - # source://stackprof//lib/stackprof/middleware.rb#20 - def call(env); end - - class << self - # Returns the value of attribute enabled. - # - # source://stackprof//lib/stackprof/middleware.rb#40 - def enabled; end - - # Sets the attribute enabled - # - # @param value the value to set the attribute enabled to. - # - # source://stackprof//lib/stackprof/middleware.rb#40 - def enabled=(_arg0); end - - # @return [Boolean] - # - # source://stackprof//lib/stackprof/middleware.rb#42 - def enabled?(env); end - - # Returns the value of attribute interval. - # - # source://stackprof//lib/stackprof/middleware.rb#40 - def interval; end - - # Sets the attribute interval - # - # @param value the value to set the attribute interval to. - # - # source://stackprof//lib/stackprof/middleware.rb#40 - def interval=(_arg0); end - - # Returns the value of attribute metadata. - # - # source://stackprof//lib/stackprof/middleware.rb#40 - def metadata; end - - # Sets the attribute metadata - # - # @param value the value to set the attribute metadata to. - # - # source://stackprof//lib/stackprof/middleware.rb#40 - def metadata=(_arg0); end - - # Returns the value of attribute mode. - # - # source://stackprof//lib/stackprof/middleware.rb#40 - def mode; end - - # Sets the attribute mode - # - # @param value the value to set the attribute mode to. - # - # source://stackprof//lib/stackprof/middleware.rb#40 - def mode=(_arg0); end - - # Returns the value of attribute path. - # - # source://stackprof//lib/stackprof/middleware.rb#40 - def path; end - - # Sets the attribute path - # - # @param value the value to set the attribute path to. - # - # source://stackprof//lib/stackprof/middleware.rb#40 - def path=(_arg0); end - - # Returns the value of attribute raw. - # - # source://stackprof//lib/stackprof/middleware.rb#40 - def raw; end - - # Sets the attribute raw - # - # @param value the value to set the attribute raw to. - # - # source://stackprof//lib/stackprof/middleware.rb#40 - def raw=(_arg0); end - - # source://stackprof//lib/stackprof/middleware.rb#50 - def save; end - end -end - -# source://stackprof//lib/stackprof/report.rb#8 -class StackProf::Report - # @return [Report] a new instance of Report - # - # source://stackprof//lib/stackprof/report.rb#42 - def initialize(data); end - - # @raise [ArgumentError] - # - # source://stackprof//lib/stackprof/report.rb#618 - def +(other); end - - # source://stackprof//lib/stackprof/report.rb#92 - def add_lines(a, b); end - - # source://stackprof//lib/stackprof/report.rb#212 - def convert_to_d3_flame_graph_format(name, stacks, depth); end - - # Returns the value of attribute data. - # - # source://stackprof//lib/stackprof/report.rb#45 - def data; end - - # source://stackprof//lib/stackprof/report.rb#80 - def files; end - - # source://stackprof//lib/stackprof/report.rb#205 - def flamegraph_row(f, x, y, weight, addr); end - - # source://stackprof//lib/stackprof/report.rb#187 - def flamegraph_stacks(raw); end - - # source://stackprof//lib/stackprof/report.rb#47 - def frames(sort_by_total = T.unsafe(nil)); end - - # source://stackprof//lib/stackprof/report.rb#76 - def max_samples; end - - # source://stackprof//lib/stackprof/report.rb#68 - def modeline; end - - # source://stackprof//lib/stackprof/report.rb#52 - def normalized_frames; end - - # source://stackprof//lib/stackprof/report.rb#72 - def overall_samples; end - - # source://stackprof//lib/stackprof/report.rb#128 - def print_alphabetical_flamegraph(f = T.unsafe(nil), skip_common = T.unsafe(nil)); end - - # source://stackprof//lib/stackprof/report.rb#495 - def print_callgrind(f = T.unsafe(nil)); end - - # source://stackprof//lib/stackprof/report.rb#242 - def print_d3_flamegraph(f = T.unsafe(nil), skip_common = T.unsafe(nil)); end - - # source://stackprof//lib/stackprof/report.rb#99 - def print_debug; end - - # source://stackprof//lib/stackprof/report.rb#103 - def print_dump(f = T.unsafe(nil)); end - - # source://stackprof//lib/stackprof/report.rb#610 - def print_file(filter, f = T.unsafe(nil)); end - - # source://stackprof//lib/stackprof/report.rb#600 - def print_files(sort_by_total = T.unsafe(nil), limit = T.unsafe(nil), f = T.unsafe(nil)); end - - # source://stackprof//lib/stackprof/report.rb#132 - def print_flamegraph(f, skip_common, alphabetical = T.unsafe(nil)); end - - # source://stackprof//lib/stackprof/report.rb#414 - def print_graphviz(options = T.unsafe(nil), f = T.unsafe(nil)); end - - # source://stackprof//lib/stackprof/report.rb#107 - def print_json(f = T.unsafe(nil)); end - - # source://stackprof//lib/stackprof/report.rb#526 - def print_method(name, f = T.unsafe(nil)); end - - # source://stackprof//lib/stackprof/report.rb#112 - def print_stackcollapse; end - - # source://stackprof//lib/stackprof/report.rb#476 - 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 - - # source://stackprof//lib/stackprof/report.rb#124 - def print_timeline_flamegraph(f = T.unsafe(nil), skip_common = T.unsafe(nil)); end - - # source://stackprof//lib/stackprof/report.rb#64 - def version; end - - # Walk up and down the stack from a given starting point (name). Loops - # until `:exit` is selected - # - # source://stackprof//lib/stackprof/report.rb#561 - def walk_method(name); end - - private - - # source://stackprof//lib/stackprof/report.rb#669 - def callers_for(addr); end - - # source://stackprof//lib/stackprof/report.rb#665 - def root_frames; end - - # source://stackprof//lib/stackprof/report.rb#674 - def source_display(f, file, lines, range = T.unsafe(nil)); end - - class << self - # source://stackprof//lib/stackprof/report.rb#12 - def from_file(file); end - - # source://stackprof//lib/stackprof/report.rb#20 - def from_json(json); end - - # source://stackprof//lib/stackprof/report.rb#24 - def parse_json(json); end - end -end - -# source://stackprof//lib/stackprof/report.rb#9 -StackProf::Report::MARSHAL_SIGNATURE = T.let(T.unsafe(nil), String) - -# source://stackprof//lib/stackprof.rb#12 -StackProf::VERSION = T.let(T.unsafe(nil), String) diff --git a/Library/Homebrew/sorbet/rbi/todo.rbi b/Library/Homebrew/sorbet/rbi/todo.rbi index 866476b0d6..73f2bbd607 100644 --- a/Library/Homebrew/sorbet/rbi/todo.rbi +++ b/Library/Homebrew/sorbet/rbi/todo.rbi @@ -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