Sha256: cd04374e54efc1ccdbb2ea7ee2947e68cdd3b54057787a53afc4fb62b6f6dc40
Contents?: true
Size: 691 Bytes
Versions: 6792
Compression:
Stored size: 691 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Lint # This cop checks for regexp literals used as `match-current-line`. # If a regexp literal is in condition, the regexp matches `$_` implicitly. # # @example # # bad # if /foo/ # do_something # end # # # good # if /foo/ =~ $_ # do_something # end class RegexpAsCondition < Cop MSG = 'Do not use regexp literal as a condition.' \ ' The regexp literal matches `$_` implicitly.'.freeze def on_match_current_line(node) add_offense(node) end end end end end
Version data entries
6,792 entries across 6,786 versions & 25 rubygems