Sha256: c278ac9b5bc0cc74fae79d2f6ca634bde92aa794d1f2b2b78644dfe464a3f103
Contents?: true
Size: 684 Bytes
Versions: 55
Compression:
Stored size: 684 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.' def on_match_current_line(node) add_offense(node) end end end end end
Version data entries
55 entries across 36 versions & 5 rubygems