diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index e06749fd4db64..0c810a3466403 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -284,7 +284,6 @@ Sorbet/TrueSigil: - "/**/{Formula,Casks}/**/*.rb" - "**/{Formula,Casks}/**/*.rb" - "Homebrew/test/**/*.rb" - - "Homebrew/extend/pathname/rmtree.rb" # Require &&/|| instead of and/or Style/AndOr: diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml index 758ea8806f9fc..a35001a936db8 100644 --- a/Library/Homebrew/.rubocop.yml +++ b/Library/Homebrew/.rubocop.yml @@ -33,7 +33,6 @@ Style/Documentation: - extend/ENV/super.rb - extend/kernel.rb - extend/pathname.rb - - extend/pathname/rmtree.rb - formula.rb - formula_assertions.rb - formula_free_port.rb diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 047dd908ee91b..ec649fe0e42cf 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -498,6 +498,21 @@ def zipinfo .encode(Encoding::UTF_8, invalid: :replace) .split("\n") end + + # Like regular `rmtree`, except it never ignores errors. + # + # This was the default behaviour in Ruby 3.1 and earlier. + # + # @api public + def rmtree(noop: nil, verbose: nil, secure: nil) + # Ideally we'd odeprecate this but probably can't given gems so let's + # create a RuboCop autocorrect instead soon. + # This is why monkeypatching is non-ideal (but right solution to get + # Ruby 3.3 over the line). + # odeprecated "rmtree", "FileUtils#rm_r" + FileUtils.rm_r(@path, noop:, verbose:, secure:) + nil + end end require "extend/os/pathname" @@ -584,5 +599,3 @@ def uninstall_info puts "uninfo #{self}" if ObserverPathnameExtension.verbose? end end - -require "extend/pathname/rmtree" diff --git a/Library/Homebrew/extend/pathname/rmtree.rb b/Library/Homebrew/extend/pathname/rmtree.rb deleted file mode 100644 index 47f603a062709..0000000000000 --- a/Library/Homebrew/extend/pathname/rmtree.rb +++ /dev/null @@ -1,19 +0,0 @@ -# typed: false -# frozen_string_literal: true - -class Pathname - # Like regular `rmtree`, except it never ignores errors. - # - # This was the default behaviour in Ruby 3.1 and earlier. - # - # @api public - def rmtree(noop: nil, verbose: nil, secure: nil) - # Ideally we'd odeprecate this but probably can't given gems so let's - # create a RuboCop autocorrect instead soon. - # This is why monkeypatching is non-ideal (but right solution to get - # Ruby 3.3 over the line). - # odeprecated "rmtree", "FileUtils#rm_r" - FileUtils.rm_r(@path, noop:, verbose:, secure:) - nil - end -end