We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
c = b && b.a.d > 1
I expect that this should be ignored by SafeNavigation, since it use an arithmetic operation that can't be captured with &.
SafeNavigation cop triggers, and autocorrects to c = b.&a.&d > 1, which is wrong since this could end up running nil > 1.
c = b.&a.&d > 1
nil > 1
Try linting the above expression.
0.52.0 (using Parser 2.4.0.2, running on ruby 2.4.2 x86_64-linux)
The text was updated successfully, but these errors were encountered:
[Fix rubocop#5287] Do not register an offense for SafeNavigation if a…
72a867c
…ny part of the method chain uses an unsafe method
30092c9
No branches or pull requests
Expected behavior
I expect that this should be ignored by SafeNavigation, since it use an arithmetic operation that can't be captured with &.
Actual behavior
SafeNavigation cop triggers, and autocorrects to
c = b.&a.&d > 1
, which is wrong since this could end up runningnil > 1
.Steps to reproduce the problem
Try linting the above expression.
RuboCop version
0.52.0 (using Parser 2.4.0.2, running on ruby 2.4.2 x86_64-linux)
The text was updated successfully, but these errors were encountered: