Sha256: 008dec2a4214c1c21398d51ca08313e6f9e8baf7f406d734671108ec57c26072

Contents?: true

Size: 446 Bytes

Versions: 4

Compression:

Stored size: 446 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Style
      # This cop looks for uses of Perl-style regexp match
      # backreferences like $1, $2, etc.
      class AvoidPerlBackrefs < Cop
        def on_nth_ref(node)
          backref, = *node

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.12.0 lib/rubocop/cop/style/avoid_perl_backrefs.rb
rubocop-0.11.1 lib/rubocop/cop/style/avoid_perl_backrefs.rb
rubocop-0.11.0 lib/rubocop/cop/style/avoid_perl_backrefs.rb
rubocop-0.10.0 lib/rubocop/cop/style/avoid_perl_backrefs.rb