Pattern: Redundant Regexp constructor
Issue: -
Checks for the instantiation of Regexp using redundant Regexp.new
or Regexp.compile
.
Autocorrect replaces to Regexp literal which is the simplest and fastest.
# bad
Regexp.new(/regexp/)
Regexp.compile(/regexp/)
# good
/regexp/
Regexp.new('regexp')
Regexp.compile('regexp')