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_cons(2) do |t1, t2|
    if kind(t1) && !whitespace?(t2)
      add_offence(:convention, t1.pos.lineno,
                  sprintf(ERROR_MESSAGE, kind(t1)))
    end
  end
end