-
-
Notifications
You must be signed in to change notification settings - Fork 88
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Hi,
New cop Performance/StringInclude introduced by #117 is unsafe when use with --auto-correct.
- It currently auto-corrects the usage of
matchand=~. But the return values betweenmatchor=~andinclude?are different. If the value is used, the behavior is altered. =~doesn't raise an error in case ofnil =~ /foobar/. Same, behavior is altered.
Two examples that broke in our codebase:
search_by_street_address = params[:types] =~ /street_address/
@agenda_requested_in_config ||= method.match(/agenda/)I think it should only fix match? and reserve match and =~ in the case of --auto-correct-all. I don't know if you can make that distinction?
If not, maybe move this cop as unsafe? What do you think?
marcandre
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working