Replace deprecated Cop.registry with Registry.global

Signed-off-by: Patrick Linnane <patrick@linnane.io>
This commit is contained in:
Patrick Linnane 2024-07-10 13:05:31 -07:00
parent 603b896131
commit 5466d6a57a
No known key found for this signature in database
2 changed files with 7 additions and 7 deletions

View File

@ -16,7 +16,7 @@ module RuboCop
attr_accessor :file_path attr_accessor :file_path
@registry = Cop.registry @registry = Registry.global
class FormulaNodes < T::Struct class FormulaNodes < T::Struct
prop :node, RuboCop::AST::ClassNode prop :node, RuboCop::AST::ClassNode

View File

@ -129,18 +129,18 @@ module Homebrew
args += ["--extra-details"] if verbose args += ["--extra-details"] if verbose
if except_cops 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| cops_to_exclude = except_cops.select do |cop|
RuboCop::Cop::Cop.registry.names.include?(cop) || RuboCop::Cop::Registry.global.names.include?(cop) ||
RuboCop::Cop::Cop.registry.departments.include?(cop.to_sym) RuboCop::Cop::Registry.global.departments.include?(cop.to_sym)
end end
args << "--except" << cops_to_exclude.join(",") unless cops_to_exclude.empty? args << "--except" << cops_to_exclude.join(",") unless cops_to_exclude.empty?
elsif only_cops 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| cops_to_include = only_cops.select do |cop|
RuboCop::Cop::Cop.registry.names.include?(cop) || RuboCop::Cop::Registry.global.names.include?(cop) ||
RuboCop::Cop::Cop.registry.departments.include?(cop.to_sym) RuboCop::Cop::Registry.global.departments.include?(cop.to_sym)
end end
odie "RuboCops #{only_cops.join(",")} were not found" if cops_to_include.empty? odie "RuboCops #{only_cops.join(",")} were not found" if cops_to_include.empty?