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

Wong --auto-correct in Style/AndOr #4352

Closed
inyerade opened this issue May 7, 2017 · 1 comment · Fixed by #4381
Closed

Wong --auto-correct in Style/AndOr #4352

inyerade opened this issue May 7, 2017 · 1 comment · Fixed by #4381
Labels

Comments

@inyerade
Copy link

inyerade commented May 7, 2017

I do not know if I miss something or I found a bug

Expected behavior

return nil unless user and user[:id]

to

return nil unless user && user[:id]

Actual behavior

return nil unless user and user[:id]

to

return nil unless user && user[:id)](

Steps to reproduce the problem

I have the lines

return nil unless user and user[:id]
{  
    status: "success",
    validation: true,
}

And when I run

rubocop --auto-correct

I get

return nil unless user && user[:id)]( 
{  
    status: "success",
    validation: true,
}

Also rubocop detect the new error

E: unexpected token tRPAREN
(Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
        return nil unless user && user[:id)](

RuboCop version

$ rubocop -V
0.48.1 (using Parser 2.4.0.0, running on ruby 2.3.1 x86_64-linux-gnu)
@bbatsov bbatsov added the bug label May 7, 2017
hoshinotsuyoshi added a commit to hoshinotsuyoshi/rubocop that referenced this issue May 8, 2017
@ClayShentrup
Copy link

Assuming this is the same thing I'm experiencing:

(a[:a] or a)
# Becomes
(a[:a)](|| a)

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

Successfully merging a pull request may close this issue.

3 participants