-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make a safe detection for
Performance/StringInclude
This PR makes a safe detection for `Performance/StringInclude` cop when `match?` argument is a variable. Symbol object does not have an `include?` method. The following is an auto-corrected example code. ```console % ruby -e ':symbol.include?(/pattern/)' Traceback (most recent call last): -e:1:in `<main>': undefined method `include?' for :symbol:Symbol (NoMethodError) ```` A variable possible to be a symbol object, so if `match?` argument is a variable, accept it. As an unsafe option it might be possible to provide detection when argument is a variable. First of all, this PR makes detection safe. This PR haven't added a changelog entry as it is an unreleased feature.
- Loading branch information
Showing
2 changed files
with
19 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters