lib/rubocop/cop/layout/space_before_comma.rb in rubocop-0.51.0 vs lib/rubocop/cop/layout/space_before_comma.rb in rubocop-0.52.0
- old
+ new
@@ -2,14 +2,25 @@
module RuboCop
module Cop
module Layout
# Checks for comma (,) preceded by space.
+ #
+ # @example
+ # # bad
+ # [1 , 2 , 3]
+ # a(1 , 2)
+ # each { |a , b| }
+ #
+ # # good
+ # [1, 2, 3]
+ # a(1, 2)
+ # each { |a, b| }
class SpaceBeforeComma < Cop
include SpaceBeforePunctuation
def kind(token)
- 'comma' if token.type == :tCOMMA
+ 'comma' if token.comma?
end
end
end
end
end