-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
False positive with DeletePrefix #118
Labels
bug
Something isn't working
Comments
koic
added a commit
to koic/rubocop-performance
that referenced
this issue
May 25, 2020
…Prefix` cops Fixes rubocop#118. Fix a false positive for `Performance/DeletePrefix` and `Performance/DeletePrefix` cops when using heredoc.
8 tasks
I believe the same bug exists for # This checks that _any_ line in the output starts with "origin"
`git remote -v`.match?(/^origin/)
# Performance/StartWith suggests this, which only tests the first line
`git remote -v`.start_with?("origin") |
I think the fix is that both cops should only flag patterns that start with |
Yes, same goes for |
koic
added a commit
to koic/rubocop-performance
that referenced
this issue
Jun 4, 2020
…Prefix` cops Fixes rubocop#118. Fix a false positive for `Performance/DeletePrefix`, `Performance/DeletePrefix`, `Performance/StartWith`, and `Performance/EndWith` cops when receiver is multiline string.
koic
added a commit
to koic/rubocop-performance
that referenced
this issue
Jun 4, 2020
…Prefix` cops Fixes rubocop#118. Fix a false positive for `Performance/DeletePrefix`, `Performance/DeletePrefix`, `Performance/StartWith`, and `Performance/EndWith` cops when receiver is multiline string.
koic
added a commit
that referenced
this issue
Jun 5, 2020
…x_and_delete_suffix [Fix #118] Fix a false positive for `DeletePrefix` and `DeletePrefix` cops
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For a multi-line string, I am using
gsub(/^ /, '')
and I receive a wrong suggestion that I should replace this call withdelete_prefix
.Note that
^
matches at the beginning of a line, not only at the beginning of the string.Expected behavior
No offense being reported.
Actual behavior
Steps to reproduce the problem
RuboCop version
The text was updated successfully, but these errors were encountered: