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

Nested fetches combined with arithmetic breaks SafeNavigation #5287

Closed
aquach opened this issue Dec 20, 2017 · 0 comments
Closed

Nested fetches combined with arithmetic breaks SafeNavigation #5287

aquach opened this issue Dec 20, 2017 · 0 comments

Comments

@aquach
Copy link

aquach commented Dec 20, 2017

Expected behavior

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 &.

Actual behavior

SafeNavigation cop triggers, and autocorrects to c = b.&a.&d > 1, which is wrong since this could end up running nil > 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)

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

No branches or pull requests

1 participant