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/StringInclude-20230322233257 #850

Merged
merged 3 commits into from
Mar 23, 2023

Conversation

github-actions[bot]
Copy link
Contributor

Rubocop challenge!

Performance/StringInclude

Safe autocorrect: No
⚠️ The autocorrect a cop can yield false positives by design.

Description

Overview

Identifies unnecessary use of a regex where String#include? would suffice.

Examples

# bad
str.match?(/ab/)
/ab/.match?(str)
str =~ /ab/
/ab/ =~ str
str.match(/ab/)
/ab/.match(str)

# good
str.include?('ab')

Auto generated by rubocop_challenger

@mathieujobin mathieujobin reopened this Mar 23, 2023
@mathieujobin mathieujobin merged commit a86ac97 into master Mar 23, 2023
@mathieujobin mathieujobin deleted the rubocop-challenge/20230322233257 branch March 23, 2023 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant