-
-
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
False positive Performance/RedundantEqualityComparisonBlock
when pattern depends on the enumerable's element
#255
Labels
bug
Something isn't working
Comments
koic
added a commit
to koic/rubocop-performance
that referenced
this issue
Aug 10, 2021
…mparisonBlock` Fixes rubocop#255. This PR fixes a false positive for `Style/RedundantEqualityComparisonBlock` when using block argument is used for an argument of operand.
8 tasks
koic
added a commit
to koic/rubocop-performance
that referenced
this issue
Aug 10, 2021
…mparisonBlock` Fixes rubocop#255. This PR fixes a false positive for `Style/RedundantEqualityComparisonBlock` when using block argument is used for an argument of operand.
koic
added a commit
to koic/rubocop-performance
that referenced
this issue
Aug 10, 2021
…alityComparisonBlock`
koic
added a commit
to koic/rubocop-performance
that referenced
this issue
Aug 10, 2021
…dantEqualityComparisonBlock`
koic
added a commit
to koic/rubocop-performance
that referenced
this issue
Aug 10, 2021
…mparisonBlock` Fixes rubocop#255. This PR fixes a false positive for `Style/RedundantEqualityComparisonBlock` when using block argument is used for an argument of operand.
koic
added a commit
to koic/rubocop-performance
that referenced
this issue
Aug 10, 2021
…lityComparisonBlock` Fixes rubocop#255. This PR fixes a false positive for `Performance/RedundantEqualityComparisonBlock` when using block argument is used for an argument of operand.
koic
added a commit
that referenced
this issue
Aug 14, 2021
…ant_equality_comparison_block [Fix #255] Fix a false positive for `Performance/RedundantEqualityComparisonBlock`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps to reproduce the problem
I have a piece of code that is trying to filter a list of key value pairs according to whether the key has a corresponding prefix in the allow list:
Actual behavior
This code works. However, RuboCop complains:
Note that making the suggested change would break the code:
path
,key[0...path.size]
does not work.i.e. the value of the
pattern
inany?
to use depends on the length of thepath
being checked, so it cannot be passed in as suggested by the check???Expected behavior
I would expect that RuboCop either doesn't complain, or suggests a fix that has the same behaviour as the existing code,
RuboCop version
The text was updated successfully, but these errors were encountered: