cloudamatic/mu

View on GitHub
cookbooks/mu-splunk/libraries/helpers.rb

Summary

Maintainability
A
0 mins
Test Coverage

Use =~ in places where the MatchData returned by #match will not be used.
Open

  if URI.parse(uri).query.to_s.match(/filename=/)

This cop identifies the use of Regexp#match or String#match, which returns #<MatchData>/nil. The return value of =~ is an integral index/nil and is more performant.

Example:

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

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

There are no issues that match your filters.

Category
Status