-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Error in PercentLiteralDelimiters cop #876
Comments
The error goes away if I specify all preferred delimiters in my
|
I'm aware what's causing the problem (we don't merge this key from the default config with its user specified version), but I'm not sure how to best handle it. Perhaps just raising a helpful error would a good enough solution? @hannestyden @jonas054 @yujinakayama More ideas are welcome! |
I haven't looked into the configuration loading yet, but would it be possible to generally use a deep merge for the configurations? In that case the behavior would be consistent for all cops. |
A deep merge would break some settings. Consider what would happen if you deep merge this:
with
Obviously our current configuration subsystem is flawed, but reworking it would be a non-trivial endeavour. I know @yujinakayama has planned an alternative approach to configuration. |
@bbatsov Do I understand correctly that your example above is expected to clear the values for the methods in the first configuration? In that case an error reporting missing configuration options would be the better solution. |
We used to have deep merge but issue #340 prompted me to remove that feature in #347.
PercentLiteralDelimiters:
'%': ()
'%i': ()
'%q': ()
'%Q': ()
'%r': '{}'
'%s': ()
'%w': ()
'%W': ()
'%x': () Then we would get a merge. |
I'd rather us not remove the "PreferredDelimiters" level. Maybe we should rework |
@bbatsov If |
@jonas054 That's actually a good idea. 👍 from me! |
@jonas054 That's a great solution to make the behavior consistent. I think it makes sense in most context when merging/augmenting objects. I'll keep it in mind for the future. Thanks for sharing. |
@jonas054 Will you implement your suggestion? |
Yes, I can do that. |
[Fix #876] Deep merge hashes in configuration when overriding
I received an error for the
PercentLiteralDelimiters
cop usingrubocop
0.19.0 andparser
2.1.7 onruby
2.1.1 with the following.rubocop.yml
configuration.It’s blowing up on the following file:
Let me know if I can provide any additional information to help debug this issue.
The text was updated successfully, but these errors were encountered: