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
If HashSyntax and SpaceAroundOperators were to change the code simultaneously, it would lead to destroyed code. The special logic was added in this commit.
But you've exposed a bug. HashSyntax avoids making its correction if it thinks that SpaceAroundOperators is about to make a change. It does this by looking at configuration. It's just that --only doesn't disable all other cops by changing their configuration, so this is not the right way to find out if SpaceAroundOperators is active.
Actually I think there's another way to solve the problem with interference between cops now. There's a loop around auto-correction that picks up exceptions caused by conflicting corrections and tries to do them one by one instead. This will work if we make the correction ranges larger so that they cause "clobbering".
Given the following file
When I run
rubocop --only HashSyntax --auto-correct
then I getBut it does not correct
:email=> "[email protected]"
. I found the comment at https://github.com/bbatsov/rubocop/blob/master/lib/rubocop/cop/style/hash_syntax.rb#L41 which says that it does not autocorrect in this cases, but I don't understand why.The text was updated successfully, but these errors were encountered: