bbatsov/rubocop — pull request #1376 by bquorning (2014-10-07 10:41:00+00:00)
Title: String methods faster than regex

Using `String#start_with?` and `String#end_with?` is always faster than comparing the string to a regex with start-of-line or end-of-line boundaries.

The regex `/^(%[qQ]?|\?|<<-)/i` in the StringLiterals cop was unnecessarily complex, and the commit message 325f042 explains how it was reduced to two calls to `#start_with?`.

The regex `/\w\?$/` in the RequireParentheses cop would check that the ending `?` of a method name was preceded by a word character. I don’t see why that would be necessary, and suggest it replaced by `#end_with?('?')`.