Sha256: 694b5b76160e98e1d82cd33d94e3609b177785e3ae5bc116971b8781ae2a20e2

Contents?: true

Size: 734 Bytes

Versions: 2

Compression:

Stored size: 734 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
                add_offence(:convention, comment.loc, MSG)
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-0.11.0 lib/rubocop/cop/style/leading_comment_space.rb
rubocop-0.10.0 lib/rubocop/cop/style/leading_comment_space.rb