From 5466d6a57ab21f2071d662b369c688310b885552 Mon Sep 17 00:00:00 2001 From: Patrick Linnane Date: Wed, 10 Jul 2024 13:05:31 -0700 Subject: [PATCH] Replace deprecated `Cop.registry` with `Registry.global` Signed-off-by: Patrick Linnane --- Library/Homebrew/rubocops/extend/formula_cop.rb | 2 +- Library/Homebrew/style.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/rubocops/extend/formula_cop.rb b/Library/Homebrew/rubocops/extend/formula_cop.rb index 602384e20c..eca8e3627b 100644 --- a/Library/Homebrew/rubocops/extend/formula_cop.rb +++ b/Library/Homebrew/rubocops/extend/formula_cop.rb @@ -16,7 +16,7 @@ module RuboCop attr_accessor :file_path - @registry = Cop.registry + @registry = Registry.global class FormulaNodes < T::Struct prop :node, RuboCop::AST::ClassNode diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index 912cc96c22..7793f003e7 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -129,18 +129,18 @@ module Homebrew args += ["--extra-details"] if verbose if except_cops - except_cops.map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") } + except_cops.map! { |cop| RuboCop::Cop::Registry.global.qualified_cop_name(cop.to_s, "") } cops_to_exclude = except_cops.select do |cop| - RuboCop::Cop::Cop.registry.names.include?(cop) || - RuboCop::Cop::Cop.registry.departments.include?(cop.to_sym) + RuboCop::Cop::Registry.global.names.include?(cop) || + RuboCop::Cop::Registry.global.departments.include?(cop.to_sym) end args << "--except" << cops_to_exclude.join(",") unless cops_to_exclude.empty? elsif only_cops - only_cops.map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") } + only_cops.map! { |cop| RuboCop::Cop::Registry.global.qualified_cop_name(cop.to_s, "") } cops_to_include = only_cops.select do |cop| - RuboCop::Cop::Cop.registry.names.include?(cop) || - RuboCop::Cop::Cop.registry.departments.include?(cop.to_sym) + RuboCop::Cop::Registry.global.names.include?(cop) || + RuboCop::Cop::Registry.global.departments.include?(cop.to_sym) end odie "RuboCops #{only_cops.join(",")} were not found" if cops_to_include.empty?