Module: RTRuboCopDefaults::Inject

Defined in:
lib/rt_rubocop_defaults/inject.rb

Overview

Because RuboCop doesn’t yet support plugins, we have to monkey patch in a bit of our configuration.

Constant Summary collapse

DEFAULT_FILE =
File.expand_path(
  "../../config/default.yml", __dir__
)

Class Method Summary collapse

Class Method Details

.defaults!Object



14
15
16
17
18
19
20
21
22
# File 'lib/rt_rubocop_defaults/inject.rb', line 14

def self.defaults!
  path = File.absolute_path(DEFAULT_FILE)
  hash = RuboCop::ConfigLoader.send(:load_yaml_configuration, path)
  config = RuboCop::Config.new(hash, path)
  puts "configuration from #{DEFAULT_FILE}" if RuboCop::ConfigLoader.debug?
  config = RuboCop::ConfigLoader.merge_with_default(config, path)

  RuboCop::ConfigLoader.instance_variable_set(:@default_configuration, config)
end