Sha256: de9b83d1a3e4c32dd272f17488d0cad74bb76df4b201b7db0ae722d700b905ce

Contents?: true

Size: 724 Bytes

Versions: 4

Compression:

Stored size: 724 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Style
      # This cop checks whether comments have a leading space
      # after the # denoting the start of the comment. The
      # leading space is not required for some RDoc special syntax,
      # like #++, #--, #:nodoc, etc.
      class LeadingCommentSpace < Cop
        MSG = 'Missing space after #.'

        def investigate(processed_source)
          processed_source.comments.each do |comment|
            if comment.text =~ /^#+[^#\s:+-]/
              unless comment.text.start_with?('#!') && comment.loc.line == 1
                convention(comment, :expression)
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.14.1 lib/rubocop/cop/style/leading_comment_space.rb
rubocop-0.14.0 lib/rubocop/cop/style/leading_comment_space.rb
rubocop-0.13.1 lib/rubocop/cop/style/leading_comment_space.rb
rubocop-0.13.0 lib/rubocop/cop/style/leading_comment_space.rb