Method: Ducalis::RegexCop#on_begin

Defined in:
lib/ducalis/cops/regex_cop.rb

#on_begin(node) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/ducalis/cops/regex_cop.rb', line 44

def on_begin(node)
  not_defined_regexes(node).each do |regex|
    next if SELF_DESCRIPTIVE.include?(regex.source) || const_dynamic?(regex)

    add_offense(regex, :expression, format(OFFENSE, present_node(regex)))
  end
end