diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index e87f5d9c58..7653a9495c 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -264,6 +264,14 @@ Layout/LineLength: ' "~/Library/Application Support/', '"~/Library/Caches/', '"~/Application Support', ' was verified as official when first introduced to the cask'] +# Enable once we are using `sorbet-runtime`. +Sorbet/FalseSigil: + Enabled: false + +# Try getting rid of these. +Sorbet/ConstantsFromStrings: + Enabled: false + # Avoid false positives on modifiers used on symbols of methods # See https://github.com/rubocop-hq/rubocop/issues/5953 Style/AccessModifierDeclarations: diff --git a/Library/Homebrew/debrew/irb.rb b/Library/Homebrew/debrew/irb.rb index e37d35b92c..b88aa44c73 100644 --- a/Library/Homebrew/debrew/irb.rb +++ b/Library/Homebrew/debrew/irb.rb @@ -4,34 +4,30 @@ require "irb" # @private module IRB - @setup_done = false + def self.parse_opts(argv: nil); end - extend Module.new { - def parse_opts; end - - def start_within(binding) - unless @setup_done - setup(nil, argv: []) - @setup_done = true - end - - workspace = WorkSpace.new(binding) - irb = Irb.new(workspace) - - @CONF[:IRB_RC]&.call(irb.context) - @CONF[:MAIN_CONTEXT] = irb.context - - trap("SIGINT") do - irb.signal_handle - end - - begin - catch(:IRB_EXIT) do - irb.eval_input - end - ensure - irb_at_exit - end + def self.start_within(binding) + unless @setup_done + setup(nil, argv: []) + @setup_done = true end - } + + workspace = WorkSpace.new(binding) + irb = Irb.new(workspace) + + @CONF[:IRB_RC]&.call(irb.context) + @CONF[:MAIN_CONTEXT] = irb.context + + trap("SIGINT") do + irb.signal_handle + end + + begin + catch(:IRB_EXIT) do + irb.eval_input + end + ensure + irb_at_exit + end + end end diff --git a/Library/Homebrew/extend/os/mac/unpack_strategy/zip.rb b/Library/Homebrew/extend/os/mac/unpack_strategy/zip.rb index b6bf16fa23..fa619816d9 100644 --- a/Library/Homebrew/extend/os/mac/unpack_strategy/zip.rb +++ b/Library/Homebrew/extend/os/mac/unpack_strategy/zip.rb @@ -2,7 +2,7 @@ module UnpackStrategy class Zip - prepend Module.new { + module MacOSZipExtension def extract_to_dir(unpack_dir, basename:, verbose:) if merge_xattrs && contains_extended_attributes?(path) # We use ditto directly, because dot_clean has issues if the __MACOSX @@ -46,6 +46,9 @@ module UnpackStrategy end end end - } + end + private_constant :MacOSZipExtension + + prepend MacOSZipExtension end end diff --git a/Library/Homebrew/rubocops.rb b/Library/Homebrew/rubocops.rb index 76b8d207b8..b2b748bb03 100644 --- a/Library/Homebrew/rubocops.rb +++ b/Library/Homebrew/rubocops.rb @@ -4,6 +4,8 @@ require_relative "load_path" require "rubocop-performance" require "rubocop-rspec" +require "rubocop-sorbet" + require "rubocops/formula_desc" require "rubocops/components_order" require "rubocops/components_redundancy" diff --git a/Library/Homebrew/sorbet/tapioca/require.rb b/Library/Homebrew/sorbet/tapioca/require.rb index ac84d1d3f0..fe1388b13a 100644 --- a/Library/Homebrew/sorbet/tapioca/require.rb +++ b/Library/Homebrew/sorbet/tapioca/require.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: true # typed: false +# frozen_string_literal: true # Add your extra requires here