Ruby

Ruby

Made by DeepSource

Use =~ in places where the MatchData returned by #match will not be used RB-PR1016

Performance
Major
Autofix

The return value of =~ is an integral index/nil and is more performant.

Bad practice

do_something if str.match(/regex/)
while regex.match('str')
  do_something
end

Recommended

method(str =~ /regex/)
return value unless regex =~ 'str'