Module: Rubocop::Cop::SpaceAfterCommaEtc

Included in:
SpaceAfterColon, SpaceAfterComma, SpaceAfterSemicolon
Defined in:
lib/rubocop/cop/space_after_comma_etc.rb

Constant Summary collapse

ERROR_MESSAGE =
'Space missing after %s.'

Instance Method Summary collapse

Instance Method Details

#inspect(file, source, tokens, sexp) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/rubocop/cop/space_after_comma_etc.rb', line 8

def inspect(file, source, tokens, sexp)
  tokens.each_index do |ix|
    t = tokens[ix]
    if kind(t) && !whitespace?(tokens[ix + 1])
      add_offence(:convention, t.pos.lineno, ERROR_MESSAGE % kind(t))
    end
  end
end