class RuboCop::Cop::Layout::SpaceAfterComma

Checks for comma (,) not followed by some kind of space.

@example

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Public Instance Methods

autocorrect(comma) click to toggle source
# File lib/rubocop/cop/layout/space_after_comma.rb, line 20
def autocorrect(comma)
  PunctuationCorrector.add_space(comma)
end
kind(token) click to toggle source
# File lib/rubocop/cop/layout/space_after_comma.rb, line 29
def kind(token)
  'comma' if token.comma?
end
space_style_before_rcurly() click to toggle source
# File lib/rubocop/cop/layout/space_after_comma.rb, line 24
def space_style_before_rcurly
  cfg = config.for_cop('Layout/SpaceInsideHashLiteralBraces')
  cfg['EnforcedStyle'] || 'space'
end