Sha256: d28b53898c004bbf9e231e874dea95a35cdde3f8a087e2bcff03f8a95806fe80

Contents?: true

Size: 463 Bytes

Versions: 3

Compression:

Stored size: 463 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}.")

          super
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
rubocop-0.9.1 lib/rubocop/cop/style/avoid_perl_backrefs.rb
sabat-rubocop-0.9.0 lib/rubocop/cop/style/avoid_perl_backrefs.rb
rubocop-0.9.0 lib/rubocop/cop/style/avoid_perl_backrefs.rb