Sha256: b7062b69479b09338f1cfdbcf2ebf7cbb349b7dc48fa0f4e240e0b3221fb2bb8

Contents?: true

Size: 720 Bytes

Versions: 6897

Compression:

Stored size: 720 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Layout
      # Checks for comma (,) not followed by some kind of space.
      #
      # @example
      #
      #   # bad
      #   [1,2]
      #   { foo:bar,}
      #
      #   # good
      #   [1, 2]
      #   { foo:bar, }
      class SpaceAfterComma < Cop
        include SpaceAfterPunctuation

        def autocorrect(comma)
          PunctuationCorrector.add_space(comma)
        end

        def space_style_before_rcurly
          cfg = config.for_cop('Layout/SpaceInsideHashLiteralBraces')
          cfg['EnforcedStyle'] || 'space'
        end

        def kind(token)
          'comma' if token.comma?
        end
      end
    end
  end
end

Version data entries

6,897 entries across 6,872 versions & 30 rubygems

Version Path
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/rubocop-0.60.0/lib/rubocop/cop/layout/space_after_comma.rb
rubocop-0.60.0 lib/rubocop/cop/layout/space_after_comma.rb
rubocop-0.59.2 lib/rubocop/cop/layout/space_after_comma.rb
rubocop-0.59.1 lib/rubocop/cop/layout/space_after_comma.rb
rubocop-0.59.0 lib/rubocop/cop/layout/space_after_comma.rb
rubocop-0.58.2 lib/rubocop/cop/layout/space_after_comma.rb
rubocop-0.58.1 lib/rubocop/cop/layout/space_after_comma.rb
rubocop-0.58.0 lib/rubocop/cop/layout/space_after_comma.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/rubocop-0.57.2/lib/rubocop/cop/layout/space_after_comma.rb
rubocop-0.57.2 lib/rubocop/cop/layout/space_after_comma.rb
rubocop-0.57.1 lib/rubocop/cop/layout/space_after_comma.rb
rubocop-0.57.0 lib/rubocop/cop/layout/space_after_comma.rb
rubocop-0.56.0 lib/rubocop/cop/layout/space_after_comma.rb
rubocop-0.55.0 lib/rubocop/cop/layout/space_after_comma.rb
rubocop-0.54.0 lib/rubocop/cop/layout/space_after_comma.rb
rubocop-0.53.0 lib/rubocop/cop/layout/space_after_comma.rb
rubocop-0.52.1 lib/rubocop/cop/layout/space_after_comma.rb