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

Respect NewCop value from merged_config #9095

Closed
ThomasKoppensteiner opened this issue Nov 25, 2020 · 0 comments
Closed

Respect NewCop value from merged_config #9095

ThomasKoppensteiner opened this issue Nov 25, 2020 · 0 comments
Labels

Comments

@ThomasKoppensteiner
Copy link
Contributor

Rubocop 1.4.2 shows a warning about pending cops, even if the NewCops: enabled is set in a required config file.
This happens because the possible_new_cops? methods in the ConfigLoader checks against config and not against merged_config.

Warning Text:

The following cops were added to RuboCop, but are not configured. Please set Enabled to either `true` or `false` in your `.rubocop.yml` file.

Please also note that can also opt-in to new cops by default by adding this to your config:
  AllCops:
    NewCops: enable

Expected behavior

I expect that for the pending new cops check the merged configuration is considered and no warning is show when the NewCops setting is configured in a shared config file.

Actual behavior

The NewCops setting is not considered and the warning about pending new cops is shown.

Steps to reproduce the problem

Use 2 configuration files.

# File: .rubocop.yml
require:
- base

# NewCops is not set here
#
#  AllCops:
#    NewCops: enable

Base

# File: base.yml
AllCops:
  NewCops: enable

RuboCop version

Include the output of rubocop -V or bundle exec rubocop -V if using Bundler. Here's an example:

$ [bundle exec] rubocop -V
1.4.2 (using Parser 2.7.2.0, rubocop-ast 1.2.0, running on jruby 2.5.7 java)
  - rubocop-rspec 2.0.0

Solution

A possible solution is, as described above in the intro, to use merged_config instead of config for the check in the ConfigLoader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants