class RuboCop::Cop::Style::CommentAnnotation
Constants
- YAYOI_MISSING_NOTE
- YAYOI_MSG
Public Instance Methods
investigate(processed_source)
click to toggle source
# File lib/rubocop/cop/style/comment_annotation.rb, line 12 def investigate(processed_source) processed_source.comments.each_with_index do |comment, index| next unless first_comment_line?(processed_source.comments, index) || inline_comment?(comment) margin, first_word, colon, space, note = split_comment(comment) next unless annotation?(comment) && !correct_annotation?(first_word, colon, space, note) length = concat_length(first_word, colon, space) add_offense( comment, location: annotation_range(comment, margin, length), message: format(message(note), keyword: first_word) ) end end
Private Instance Methods
message(note)
click to toggle source
# File lib/rubocop/cop/style/comment_annotation.rb, line 32 def message(note) note ? YAYOI_MSG : YAYOI_MISSING_NOTE end