Sha256: 622e412fe3768ea9f2fef2f667a8af75f27173421d1f4af3f5a29aa3f6609ae9

Contents?: true

Size: 738 Bytes

Versions: 2

Compression:

Stored size: 738 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    class SpaceAfterCommaEtc < Cop
      ERROR_MESSAGE = 'Space missing after %s.'

      def inspect(file, source, tokens, sexp)
        tokens.each_index do |ix|
          t = tokens[ix]
          kind = case t.type
                 when :on_comma     then 'comma'
                 when :on_label     then 'colon'
                 when :on_op        then 'colon' if t.text == ':'
                 when :on_semicolon then 'semicolon'
                 end
          if kind and not [:on_sp,
                           :on_ignored_nl].include?(tokens[ix + 1].type)
            add_offence(:convention, t.pos.lineno, ERROR_MESSAGE % kind)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-0.2.1 lib/rubocop/cop/space_after_comma_etc.rb
rubocop-0.2.0 lib/rubocop/cop/space_after_comma_etc.rb