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

Improve the Performance/RedundantEqualityComparisonBlock cop #424

Open
ydakuka opened this issue Dec 15, 2023 · 0 comments
Open

Improve the Performance/RedundantEqualityComparisonBlock cop #424

ydakuka opened this issue Dec 15, 2023 · 0 comments

Comments

@ydakuka
Copy link
Contributor

ydakuka commented Dec 15, 2023

Describe the solution you'd like

https://www.bigbinary.com/blog/ruby-2-5-enumerable-predicates-accept-pattern-argument

For all?, none?, one? and any?:

# bad
queries.any? { |sql| /LEFT OUTER JOIN/i =~ sql }

# good
queries.any?(/LEFT OUTER JOIN/i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants