From b3b6c147fbf1288fea335fd6202b8ff2d329fca7 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Tue, 1 Apr 2025 21:05:43 -0700 Subject: [PATCH] perf: rubocop/tapioca parser optimizations --- Library/.rubocop.yml | 5 +++++ Library/Homebrew/sorbet/rbi/{gems => }/parser@3.3.7.4.rbi | 0 Library/Homebrew/sorbet/tapioca/config.yml | 5 +++++ 3 files changed, 10 insertions(+) rename Library/Homebrew/sorbet/rbi/{gems => }/parser@3.3.7.4.rbi (100%) diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index d6442a32c0..c8002518e2 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -18,12 +18,17 @@ inherit_mode: - Exclude AllCops: + # TODO: This is the default parser in Ruby >= 3.4 + # https://github.com/rubocop/rubocop-ast/blob/6b9136235219e9448ee4f369e17cf69bcd9db621/lib/rubocop/ast/processed_source.rb#L385 + ParserEngine: parser_prism TargetRubyVersion: 3.3 NewCops: enable Include: - "**/*.rbi" Exclude: - "Homebrew/sorbet/rbi/{dsl,gems}/**/*.rbi" + # TODO: remove file and exclusion in Ruby 3.4 + - "Homebrew/sorbet/rbi/parser*.rbi" - "Homebrew/bin/*" - "Homebrew/vendor/**/*" - "Taps/*/*/vendor/**/*" diff --git a/Library/Homebrew/sorbet/rbi/gems/parser@3.3.7.4.rbi b/Library/Homebrew/sorbet/rbi/parser@3.3.7.4.rbi similarity index 100% rename from Library/Homebrew/sorbet/rbi/gems/parser@3.3.7.4.rbi rename to Library/Homebrew/sorbet/rbi/parser@3.3.7.4.rbi diff --git a/Library/Homebrew/sorbet/tapioca/config.yml b/Library/Homebrew/sorbet/tapioca/config.yml index 248e9a1266..bca0e01ca9 100644 --- a/Library/Homebrew/sorbet/tapioca/config.yml +++ b/Library/Homebrew/sorbet/tapioca/config.yml @@ -37,4 +37,9 @@ gem: # The tapioca generated gem is not correct or sufficient for pycall # so we need to generate our own: - pycall + # Skipping rbi generation for parser results in a 7x performance + # improvement in `brew typecheck --update--all`, so we just persist it + # instead. (This gem is only needed by rubocop, which is in the process of + # migrating to prism.) + - parser prerequire: sorbet/tapioca/prerequire.rb