module CopHelper

def registry

def registry
  @registry ||= begin
    keys = configuration.keys
    cops =
      keys.map { |directive| RuboCop::Cop::Registry.global.find_cops_by_directive(directive) }
          .flatten
    cops << cop_class if defined?(cop_class) && !cops.include?(cop_class)
    cops.compact!
    RuboCop::Cop::Registry.new(cops)
  end
end