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

RedundantSplitRegexpArgument false positive for case-insensitive regexes #216

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

Comments

@s-mage
Copy link

s-mage commented Mar 1, 2021

Case-insensitive regexes shouldn't be replaced with strings in split

> "oneSpLiTtwo".split("split")
=> ["oneSpLiTtwo"]
> "oneSpLiTtwo".split(/split/i)
=> ["one", "two"]

Expected behavior

Don't trigger RedundantSplitRegexpArgument for case-insensitive regexes

Actual behavior

Rubocop triggers RedundantSplitRegexpArgument for case-insensitive regexes

Steps to reproduce the problem

Run rubocop on

content.split(/separator/i)

RuboCop version

-> be rubocop -V
1.10.0 (using Parser 3.0.0.0, rubocop-ast 1.4.1, running on ruby 2.6.5 x86_64-darwin19)
  - rubocop-performance 1.10.0
  - rubocop-rails 2.9.1
@s-mage s-mage changed the title Performance/RedundantSplitRegexpArgument false positive for case-insensitive regexes RedundantSplitRegexpArgument false positive for case-insensitive regexes Mar 1, 2021
@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
…tRegexpArgument`

Fixes rubocop#216.

This PR fixes a false positive for `Performance/RedundantSplitRegexpArgument`
when using split method with ignore case regexp option.
koic added a commit to koic/rubocop-performance that referenced this issue Mar 1, 2021
…tRegexpArgument`

Fixes rubocop#216.

This PR fixes a false positive for `Performance/RedundantSplitRegexpArgument`
when using split method with ignore case regexp option.
@koic koic closed this as completed in #219 Mar 1, 2021
koic added a commit that referenced this issue Mar 1, 2021
…redundant_split_regexp_argument

[Fix #216] Fix a false positive for `Performance/RedundantSplitRegexpArgument`
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