Method: RuboCop::ConfigLoader.inject_defaults!
- Defined in:
- lib/rubocop/config_loader.rb
.inject_defaults!(config_yml_path) ⇒ Object
This API is primarily intended for testing and documenting plugins. When testing a plugin using rubocop/rspec/support, the plugin is loaded automatically, so this API is usually not needed. It is intended to be used only when implementing tests that do not use rubocop/rspec/support.
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/rubocop/config_loader.rb', line 159 def inject_defaults!(config_yml_path) if Pathname(config_yml_path).directory? warn Rainbow(" Use config YAML file path instead of project root directory.\n e.g., `path/to/config/default.yml`\n MESSAGE\n raise ArgumentError,\n 'Passing a project root directory to `inject_defaults!` is no longer supported.'\n end\n\n path = config_yml_path.to_s\n hash = ConfigLoader.load_yaml_configuration(path)\n config = Config.new(hash, path).tap(&:make_excludes_absolute)\n\n @default_configuration = ConfigLoader.merge_with_default(config, path)\nend\n").yellow, uplevel: 1 |