Skip to content

Commit

Permalink
Merge pull request #7888 from jonas054/7790_parallel_disabling_other_…
Browse files Browse the repository at this point in the history
…options

[Fix #7790] Set options in ConfigLoader earlier
  • Loading branch information
koic committed Apr 18, 2020
2 parents c4ce01c + 617bee2 commit cf00efb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,7 @@
### Bug fixes

* [#7882](https://github.com/rubocop-hq/rubocop/pull/7882): Fix `Style/CaseEquality` when `AllowOnConstant` is `true` and the method receiver is implicit. ([@rafaelfranca][])
* [#7790](https://github.com/rubocop-hq/rubocop/issues/7790): Fix `--parallel` and `--ignore-parent-exclusion` combination. ([@jonas054][])

### Changes

Expand Down
3 changes: 1 addition & 2 deletions lib/rubocop/cli.rb
Expand Up @@ -35,6 +35,7 @@ def run(args = ARGV)
if @options[:init]
run_command(:init)
else
set_options_to_config_loader
validate_options_vs_config
act_on_options
apply_default_formatter
Expand Down Expand Up @@ -83,8 +84,6 @@ def validate_options_vs_config
end

def act_on_options
set_options_to_config_loader

@config_store.options_config = @options[:config] if @options[:config]
@config_store.force_default_config! if @options[:force_default_config]

Expand Down
19 changes: 19 additions & 0 deletions spec/rubocop/cli/cli_options_spec.rb
Expand Up @@ -47,6 +47,25 @@
expect($stdout.string).not_to match(/Running parallel inspection/)
end
end

context 'in combination with --ignore-parent-exclusion' do
before do
create_file('.rubocop.yml', ['AllCops:',
' Exclude:',
' - subdir/*'])
create_file('subdir/.rubocop.yml', ['AllCops:',
' Exclude:',
' - foobar'])
create_file('subdir/test.rb', 'puts 1')
end

it 'does ignore the exclusion in the parent directory configuration' do
Dir.chdir('subdir') do
cli.run ['--parallel', '--ignore-parent-exclusion']
end
expect($stdout.string).to match(/Inspecting 1 file/)
end
end
end
end

Expand Down

0 comments on commit cf00efb

Please sign in to comment.