You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect to be able to merge my configuration with rubocop default configuration, even if I also inherit a non-default configuration.
Actual behavior
At the project .rubocop.yml, if I define an array that already exists within rubocop's default configuration, my configuration overwrites' the default config, even if inherit_mode is set to merge on the cop level
When I run rubocop --debug --show-cops Naming/VariableNumber I get this output:
(note that AllowedIdentifiers does not include capture3 or any of the items defined at the default configuration)
For /Users/Drowze/r/rubocop_bug9: configuration from /Users/Drowze/r/rubocop_bug9/.rubocop.yml
configuration from /Users/Drowze/r/rubocop_bug9/.rubocop-https---gist-githubusercontent-com-Drowze-0ea51fa5bf3cbec9e280f2f913be57df-raw-eaa3ac4911b982ddf933e32e4f53d91c41cebb43-rubocop-test-yml
Default configuration from /Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.19.0/config/default.yml
Naming/VariableNumber:
Description: Use the configured style when numbering symbols, methods and variables.
StyleGuide: "#snake-case-symbols-methods-vars-with-numbers"
Enabled: true
VersionAdded: '0.50'
VersionChanged: '1.4'
EnforcedStyle: snake_case
SupportedStyles:
- snake_case
- normalcase
- non_integer
CheckMethodNames: true
CheckSymbols: true
AllowedIdentifiers:
- iso2
Exclude:
- "/Users/Drowze/r/rubocop_bug9/foo.rb"
- "/Users/Drowze/r/rubocop_bug9/test.rb"
Include:
- bar.rb
- another_test.rb
Finished in 0.111557999975048 seconds
From my test I also found:
if I move inherit_mode to the root level, AllowedIdentifiers is merged correctly
if I do not inherit configuration (via inherit_from or inherit_gem), AllowedIdentifiers is merged correctly
…t config
The problem was that we deleted the `inherit_mode` entry in the
configuration hash while processing the resolution of inheritance from
base configurations (`inherit_from`, etc.). When the merging of default
configuration and user configuration was done at a later stage, the
`inherit_mode` parameter was gone.
By not deleting `inherit_mode`, we fix the problem. I don't think it
has any unwanted side effects, but `inherit_mode` does show up in the
output from `--show-cops` now. This should be OK.
Expected behavior
I expect to be able to merge my configuration with rubocop default configuration, even if I also inherit a non-default configuration.
Actual behavior
At the project
.rubocop.yml
, if I define an array that already exists within rubocop's default configuration, my configuration overwrites' the default config, even ifinherit_mode
is set to merge on the cop levelSteps to reproduce the problem
Given a hosted configuration (gist here):
And given
.rubocop.yml
:When I run
rubocop --debug --show-cops Naming/VariableNumber
I get this output:(note that
AllowedIdentifiers
does not includecapture3
or any of the items defined at the default configuration)From my test I also found:
inherit_mode
to the root level, AllowedIdentifiers is merged correctlyinherit_from
orinherit_gem
), AllowedIdentifiers is merged correctlyRuboCop version
The text was updated successfully, but these errors were encountered: