5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/shirobai/inject.rb', line 5
def self.replace_cops!
registry = RuboCop::Cop::Registry.global
Shirobai::Cop.constants(false).each do |department|
mod = Shirobai::Cop.const_get(department)
next unless mod.is_a?(Module)
mod.constants(false).each do |cop_name|
klass = mod.const_get(cop_name)
next unless klass < RuboCop::Cop::Base
original = registry.find { |c| c.cop_name == klass.cop_name }
next unless original
registry.dismiss(original)
registry.enlist(klass)
end
end
end
|