diff --git a/CHANGELOG.md b/CHANGELOG.md index ccb06d0b744..0106851936f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/rubocop/cli.rb b/lib/rubocop/cli.rb index 107b2b4fb59..030043bc6c6 100644 --- a/lib/rubocop/cli.rb +++ b/lib/rubocop/cli.rb @@ -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 @@ -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] diff --git a/spec/rubocop/cli/cli_options_spec.rb b/spec/rubocop/cli/cli_options_spec.rb index 451815b69ae..bca6206f797 100644 --- a/spec/rubocop/cli/cli_options_spec.rb +++ b/spec/rubocop/cli/cli_options_spec.rb @@ -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