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

Performance/RedundantEqualityComparisonBlock doesn't consider multidimensional arrays #214

Closed
davidenglishmusic opened this issue Mar 1, 2021 · 0 comments · Fixed by #215 or ministryofjustice/Claim-for-Crown-Court-Defence#3815
Labels
bug Something isn't working

Comments

@davidenglishmusic
Copy link

davidenglishmusic commented Mar 1, 2021

The cop assumes the input is a single dimensional array.


Expected behavior

It should not flag the infraction with an incorrect suggestion.

Actual behavior

It flags the infraction with an incorrect suggestion.

Steps to reproduce the problem

Run bundle exec rubocop -a on the following code:

[%w[lettuce vegetable], %w[orange fruit], %w[asparagus vegetable]].any? { |name, _type| name == 'orange' }

C: [Correctable] Performance/RedundantEqualityComparisonBlock: Use any?('orange') instead of block.

RuboCop version

1.10.0 (using Parser 3.0.0.0, rubocop-ast 1.4.1, running on ruby 2.6.6 x86_64-darwin20)
  - rubocop-performance 1.10.0
  - rubocop-rails 2.9.1
  - rubocop-rspec 2.2.0
@koic koic added the bug Something isn't working label Mar 1, 2021
koic added a commit to koic/rubocop-performance that referenced this issue Mar 1, 2021
…lityComparisonBlock`

Fixes rubocop#214.

This PR fixes a false positive for `Performance/RedundantEqualityComparisonBlock`
when using multiple block arguments.
@koic koic closed this as completed in #215 Mar 1, 2021
koic added a commit that referenced this issue Mar 1, 2021
…uality_comparison_block

[Fix #214] 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
Labels
bug Something isn't working
Projects
None yet
2 participants