You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect this code to trigger SafeNavigationChain:
b&.select { true }.join
This should be corrected to
b&.select { true }&.join
Actual behavior
No offense is surfaced.
Steps to reproduce the problem
Try the example above.
RuboCop version
0.52.0 (using Parser 2.4.0.2, running on ruby 2.4.2 x86_64-linux)
This issue was exacerbated by autocorrect for SafeNavigation, which turned a && a.select {}.join into a&.select {}.join, which would be bad if a is nil. But I think the fault lies with SafeNavigationChain for not propagating that through. However, propagation is not always possible, such as in the case of a && a.select {}.length > 1 or a && a.select {}[0].
The text was updated successfully, but these errors were encountered:
Expected behavior
I expect this code to trigger SafeNavigationChain:
This should be corrected to
Actual behavior
No offense is surfaced.
Steps to reproduce the problem
Try the example above.
RuboCop version
This issue was exacerbated by autocorrect for SafeNavigation, which turned
a && a.select {}.join
intoa&.select {}.join
, which would be bad ifa
isnil
. But I think the fault lies with SafeNavigationChain for not propagating that through. However, propagation is not always possible, such as in the case ofa && a.select {}.length > 1
ora && a.select {}[0]
.The text was updated successfully, but these errors were encountered: