-
-
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
Style/ParallelAssignment for array swapping #2464
Comments
Yes. It's a bug. This cop tries to find an ordering of assignments which doesn't change the meaning of the code. If it can't find one, it's not supposed to issue a warning. |
Just a clarification, Rubocop has the same bug for swapping values of hash or object attributes:
|
I think the issue stems from the cop seeing these as method calls instead of as assignments. I will try to dig into this cop to fix it. |
@alexdowad I may need some help with this one. There was a change in the code to start using |
@rrosenblum, no problem. I am just going for dinner now, but will look at it later. |
|
After looking at the cop, that is what I was thinking. I had some guesses with how it would need to be modified, but I would need to play with it to really figure out how it needs to be changed. |
Hey @rrosenblum... just opened a PR which fixes this one. If you are interested, try reading the comments at the top of |
I just read over the docs at the top of |
I have code like this. I just need to swap two elements in array
rubocop game me this offence:
By documentation of Style/ParallelAssignment cop I cannot understand that is wrong with my code.
Is this a bug in cop, or there is better way to swap elements in my array?
I use
rubocop 0.35.1 (using Parser 2.2.3.0, running on ruby 2.1.6 x86_64-linux)
The text was updated successfully, but these errors were encountered: