Skip to content
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

Incorrect auto-correction #2654

Closed
tomhughes opened this issue Jan 16, 2016 · 2 comments
Closed

Incorrect auto-correction #2654

tomhughes opened this issue Jan 16, 2016 · 2 comments
Labels

Comments

@tomhughes
Copy link

When run on this code:

netmask = (~IPAddr.new(address).mask(0)).mask(prefix)

rubocop reports:

cookbooks/networking/recipes/default.rb:38:56: C: Don't use parentheses around a method call.

and corrects it to:

netmask = ~IPAddr.new(address).mask(0).mask(prefix)

but removing the parentheses means than the ~ is applied after the call to the mask method instead of before it.

This is a change between 0.34.2 and 0.36.0 as the earlier version didn't complain about this code.

@bbatsov
Copy link
Collaborator

bbatsov commented Jan 16, 2016

Seems we failed to account for unary ops in this cop.

@bbatsov bbatsov added the bug label Jan 16, 2016
@lumeet
Copy link
Contributor

lumeet commented Jan 16, 2016

Ouch, I'll take care of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants