-
-
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
[Fix #48] Fix RegexpMatch false positive #49
Conversation
## 1.2.0 (2019-05-04) | ||
|
||
### Bug fixes | ||
|
||
* [#47](https://github.com/rubocop-hq/rubocop-performance/pull/47): Fix a false negartive for `Performance/RegexpMatch` when using RuboCop 0.68 or higher. ([@koic][]) | ||
* [#47](https://github.com/rubocop-hq/rubocop-performance/pull/47): Fix a false negative for `Performance/RegexpMatch` when using RuboCop 0.68 or higher. ([@koic][]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated typo fix
@@ -80,14 +80,14 @@ class RegexpMatch < Cop | |||
# Constants are included in this list because it is unlikely that | |||
# someone will store `nil` as a constant and then use it for comparison | |||
TYPES_IMPLEMENTING_MATCH = %i[const regexp str sym].freeze | |||
MSG = | |||
'Use `match?` instead of `%<current>s` when `MatchData` ' \ | |||
MSG = 'Use `match?` instead of `%<current>s` when `MatchData` ' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to resolve a Metrics/ClassLength
cop violation.
1672399
to
446b0be
Compare
CHANGELOG.md
Outdated
@@ -2,11 +2,15 @@ | |||
|
|||
## master (unreleased) | |||
|
|||
### Bug fixes | |||
|
|||
* [#48](https://github.com/rubocop-hq/rubocop-performance/issues/48): Fix false positives in `Performance/RegexpMatch`. ([@dduugg][]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you write a little more about what false positives have been fixed?
This code looks good. Could you please rebase using latest master branch? A warning will probably occur because Ruby 2.2 was dropped. |
446b0be
to
1c61089
Compare
@koic I've updated the changelog to detail the change, and rebased on current master. Please take another look. Thanks! |
Thanks! |
This fixes false positives in
Performance/RegexpMatch
by only flagging single-argumentmatch
methods where either the receiver or the argument is a literal of typeRegexp
,String
,Symbol
.Resolves #48
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).and description in grammatically correct, complete sentences.
bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.