Sha256: 603cc59b8f3360a976c5201d7ce7ca7900f07f37385ecdd5a0d0518eff4a5f79
Contents?: true
Size: 991 Bytes
Versions: 2
Compression:
Stored size: 991 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop module SpaceAfterCommaEtc ERROR_MESSAGE = 'Space missing after %s.' 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, sprintf(ERROR_MESSAGE, kind(t))) end end end end class SpaceAfterComma < Cop include SpaceAfterCommaEtc def kind(token) 'comma' if token.type == :on_comma end end class SpaceAfterSemicolon < Cop include SpaceAfterCommaEtc def kind(token) 'semicolon' if token.type == :on_semicolon end end class SpaceAfterColon < Cop include SpaceAfterCommaEtc def kind(token) case token.type when :on_label then 'colon' when :on_op then 'colon' if token.text == ':' end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.6.0 | lib/rubocop/cop/space_after_comma_etc.rb |
rubocop-0.5.0 | lib/rubocop/cop/space_after_comma_etc.rb |