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

Bug Report: Autocorrect Performance/RedundantEqualityComparisonBlock error #359

Closed
ydakuka opened this issue May 17, 2023 · 0 comments · Fixed by #360
Closed

Bug Report: Autocorrect Performance/RedundantEqualityComparisonBlock error #359

ydakuka opened this issue May 17, 2023 · 0 comments · Fixed by #360
Labels
bug Something isn't working

Comments

@ydakuka
Copy link
Contributor

ydakuka commented May 17, 2023

Steps to reproduce the problem

I have the following code:

return unless path.all? { |s| s == s.underscore }

I run the autocorrect command:

ydakuka@yauhenid:~/Work/project$ bin/rails_docker rubocop -A app/helpers/view_identification_helper.rb 
Inspecting 1 file
C

Offenses:

app/helpers/view_identification_helper.rb:33:24: C: [Corrected] Performance/RedundantEqualityComparisonBlock: Use all?(s.underscore) instead of block.
    return unless path.all? { |s| s == s.underscore }
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1 file inspected, 1 offense detected, 1 offense corrected

I've got the following code:

return unless path.all?(s.underscore)

RuboCop version

ydakuka@yauhenid:~/Work/project$ bin/rails_docker rubocop -V
1.50.2 (using Parser 3.2.2.1, rubocop-ast 1.28.1, running on ruby 2.7.8) [x86_64-linux]
  - rubocop-capybara 2.18.0
  - rubocop-performance 1.17.1
  - rubocop-rails 2.19.1
  - rubocop-rake 0.6.0
  - rubocop-rspec 2.22.0
@koic koic added the bug Something isn't working label May 17, 2023
koic added a commit to koic/rubocop-performance that referenced this issue May 17, 2023
…lityComparisonBlock`

Fixes rubocop#359.

This PR fixes a false positive for `Performance/RedundantEqualityComparisonBlock`
when the block variable is used on both sides of `==`.
koic added a commit to koic/rubocop-performance that referenced this issue May 17, 2023
…lityComparisonBlock`

Fixes rubocop#359.

This PR fixes a false positive for `Performance/RedundantEqualityComparisonBlock`
when the block variable is used on both sides of `==`.
@koic koic closed this as completed in #360 May 20, 2023
koic added a commit that referenced this issue May 20, 2023
…e_redundant_equality_comparison_block

[Fix #359] 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