Sha256: 9cfc51ff78fbe689b1ce1ea4323df83cfaa64edee8313d39e7f5bff13d817e82

Contents?: true

Size: 493 Bytes

Versions: 5

Compression:

Stored size: 493 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    class FavorPercentR < Cop
      ERROR_MESSAGE = 'Use %r for regular expressions matching more ' +
        "than one '/' character."

      def inspect(file, source, tokens, sexp)
        tokens.each_cons(2) do |t1, t2|
          if t1.type == :on_regexp_beg && t1.text == '/' &&
              t2.text.scan(/\//).size > 1
            add_offence(:convention, t1.pos.lineno, ERROR_MESSAGE)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubocop-0.7.2 lib/rubocop/cop/favor_percent_r.rb
rubocop-0.7.1 lib/rubocop/cop/favor_percent_r.rb
rubocop-0.7.0 lib/rubocop/cop/favor_percent_r.rb
rubocop-0.6.1 lib/rubocop/cop/favor_percent_r.rb
rubocop-0.6.0 lib/rubocop/cop/favor_percent_r.rb