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 all commits
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Expand Up @@ -21,6 +21,7 @@
* [#7841](https://github.com/rubocop-hq/rubocop/issues/7841): Fix an error for `Style/TrailingCommaInBlockArgs` when lambda literal (`->`) has multiple arguments. ([@koic][])
* [#7842](https://github.com/rubocop-hq/rubocop/issues/7842): Fix a false positive for `Lint/RaiseException` when Exception without cbase specified under the namespace `Gem` by adding `AllowedImplicitNamespaces` option. ([@koic][])
* `Style/IfUnlessModifier` does not infinite-loop when autocorrecting long lines which use if/unless modifiers and have multiple statements separated by semicolons. ([@alexdowad][])
* [rubocop-hq/rubocop-rails#127](https://github.com/rubocop-hq/rubocop-rails/issues/127): Use `ConfigLoader.default_configuration` for the default config. ([@hanachin][])

### Changes

Expand Down Expand Up @@ -4441,6 +4442,7 @@
[@mangara]: https://github.com/mangara
[@pirj]: https://github.com/pirj
[@pawptart]: https://github.com/pawptart
[@hanachin]: https://github.com/hanachin
[@cetinajero]: https://github.com/cetinajero
[@gfyoung]: https://github.com/gfyoung
[@Tietew]: https://github.com/Tietew
Expand All @@ -4455,4 +4457,4 @@
[@rafaelfranca]: https://github.com/rafaelfranca
[@knu]: https://github.com/knu
[@saurabhmaurya15]: https://github.com/saurabhmaurya15
[@DracoAter]: https://github.com/DracoAter
[@DracoAter]: https://github.com/DracoAter
4 changes: 2 additions & 2 deletions lib/rubocop/config_loader.rb
Expand Up @@ -84,9 +84,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 @@ -671,7 +671,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