-
-
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
autocorrect creates invalid code on 'or' replacement #387
Comments
rubocop version is: 0.10.0 |
That's a known problem. Doing the autocorrection correctly is pretty complex, so we took a sneaky shortcut here. Maybe we should drop this particular autocorrection? Or we could simply correct only nodes for which replacing Maybe @jonas054, @edzhelyov and @yujinakayama have a better solution in mind? |
No I don't have a better solution. We should do as you suggest. But I have a feeling it could be complicated to get it right. In that case we should remove this autocorrection first, and release, then implement an autocorrection of |
For now, I also think we don't have better way. In the future, I think probably we need to implement some way to handle precedences of Ruby syntax, though I guess it's not easy and requires robust logic. |
Currently we have only 3-4 simple auto corrections and I expect to have similar issues. |
@edzhelyov Makes a good point. |
I'll try to implement something based on what @edzhelyov said. |
With auto-correct, the following code will be corrected into an invalid syntax:
becomes
A possible correction would be:
The text was updated successfully, but these errors were encountered: