class Rubocop::Cop::Style::LeadingCommentSpace
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.
Constants
- MSG
Public Instance Methods
inspect(source_buffer, source, tokens, ast, comments)
click to toggle source
# File lib/rubocop/cop/style/leading_comment_space.rb, line 13 def inspect(source_buffer, source, tokens, ast, comments) 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