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

Add support for !~ to Style/SelectByRegexp #11219

Closed
vlad-pisanov opened this issue Dec 1, 2022 · 0 comments · Fixed by #11221
Closed

Add support for !~ to Style/SelectByRegexp #11219

vlad-pisanov opened this issue Dec 1, 2022 · 0 comments · Fixed by #11221

Comments

@vlad-pisanov
Copy link

Currently, Style/SelectByRegexp recognizes =~ but not !~:

list.select { |n| n =~ /good/ } # cop recommends list.grep(/good/) ✔️
list.select { |n| n !~ /bad/ }  # cop ignores 😔

Ideally, it would recommend list.grep_v(/bad/)

koic added a commit to koic/rubocop that referenced this issue Dec 1, 2022
Fixes rubocop#11219.

This PR makes `Style/SelectByRegexp` aware of `!~` method.
bbatsov pushed a commit that referenced this issue Dec 2, 2022
Fixes #11219.

This PR makes `Style/SelectByRegexp` aware of `!~` method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants