Sha256: 1b3a018e59ac0d2fc1c48eb6bf3160c95b156aafe0a6a00915ad8495f5273296

Contents?: true

Size: 760 Bytes

Versions: 1

Compression:

Stored size: 760 Bytes

Contents

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubocop-0.1.0 lib/rubocop/cop/space_after_comma_etc.rb