Class: Rubocop::Cop::AvoidPerlBackrefs

Inherits:
Cop
  • Object
show all
Defined in:
lib/rubocop/cop/avoid_perl_backrefs.rb

Instance Attribute Summary

Attributes inherited from Cop

#debug, #disabled_lines, #offences

Instance Method Summary collapse

Methods inherited from Cop

#add_offence, cop_name, #has_report?, #ignore_node, inherited, #initialize, #inspect, #name, #on_comment

Constructor Details

This class inherits a constructor from Rubocop::Cop::Cop

Instance Method Details

#on_nth_ref(node) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/rubocop/cop/avoid_perl_backrefs.rb', line 6

def on_nth_ref(node)
  backref, = *node

  add_offence(:convention,
              node.loc.line,
              "Prefer the use of MatchData over $#{backref}.")

  super
end