Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ConfigLoader.default_configuration for default #7632

Merged
merged 2 commits into from Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,10 @@

## master (unreleased)

### Bug fixes

* [rubocop-hq/rubocop-rails#127](https://github.com/rubocop-hq/rubocop-rails/issues/127): Use `ConfigLoader.default_configuration` for the default config. ([@hanachin][])

## 0.79.0 (2020-01-06)

### New features
Expand Down Expand Up @@ -4320,3 +4324,4 @@
[@mangara]: https://github.com/mangara
[@pirj]: https://github.com/pirj
[@pawptart]: https://github.com/pawptart
[@hanachin]: https://github.com/hanachin
4 changes: 2 additions & 2 deletions lib/rubocop/config_loader.rb
Expand Up @@ -83,9 +83,9 @@ def configuration_file_for(target_dir)
end

def configuration_from_file(config_file)
config = load_file(config_file)
return config if config_file == DEFAULT_FILE
return ConfigLoader.default_configuration if config_file == DEFAULT_FILE

config = load_file(config_file)
if ignore_parent_exclusion?
print 'Ignoring AllCops/Exclude from parent folders' if debug?
else
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cli/cli_options_spec.rb
Expand Up @@ -508,7 +508,7 @@ class SomeCop < Cop
home = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__))))
expect($stdout.string.lines.grep(/configuration/).map(&:chomp))
.to eq(["For #{abs('')}:" \
" configuration from #{home}/config/default.yml"])
" Default configuration from #{home}/config/default.yml"])
end

it 'shows cop names' do
Expand Down
1 change: 1 addition & 0 deletions spec/support/cli_spec_behavior.rb
Expand Up @@ -11,6 +11,7 @@ def abs(path)

before do
RuboCop::ConfigLoader.debug = false
RuboCop::ConfigLoader.default_configuration = nil

# OPTIMIZE: Makes these specs faster. Work directory (the parent of
# .rubocop_cache) is removed afterwards anyway.
Expand Down