-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Fix a false negative for Performance/ReverseEach
when safe navigation is between reverse
and each
#392
Fix a false negative for Performance/ReverseEach
when safe navigation is between reverse
and each
#392
Conversation
@@ -27,7 +27,7 @@ class ReverseEach < Base | |||
RESTRICT_ON_SEND = %i[each].freeze | |||
|
|||
def_node_matcher :reverse_each?, <<~MATCHER | |||
(send (call _ :reverse) :each) | |||
({send csend} (call _ :reverse) :each) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
({send csend} (call _ :reverse) :each) | |
(call (call _ :reverse) :each) |
CI has been failed. Can you rebase with the latest master branch? |
1f9237a
to
73b8334
Compare
Updated. |
@@ -12,6 +12,8 @@ | |||
expect_offense(<<~RUBY) | |||
array&.reverse.each { |e| puts e } | |||
^^^^^^^^^^^^ Use `reverse_each` instead of `reverse.each`. | |||
array&.reverse&.each { |e| puts e } | |||
^^^^^^^^^^^^^ Use `reverse_each` instead of `reverse.each`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please separate this, an independent test instead of mixing it in the existing it
block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hate inventing new names for tests 😅 Updated
…on is between `reverse` and `each`
73b8334
to
761025b
Compare
Fixes #390.