class RuboCop::Cop::Style::CommentAnnotation

to guidelines.
This cop checks that comment annotation keywords are written according

def annotation_range(comment, margin, length)

def annotation_range(comment, margin, length)
  start = comment.loc.expression.begin_pos + margin.length
  range_between(start, start + length)
end

def autocorrect(comment)

def autocorrect(comment)
  margin, first_word, colon, space, note = split_comment(comment)
  return if note.nil?
  length = concat_length(first_word, colon, space)
  range = annotation_range(comment, margin, length)
  ->(corrector) { corrector.replace(range, "#{first_word.upcase}: ") }
end

def concat_length(*args)

def concat_length(*args)
  args.reduce(0) { |acc, elem| acc + elem.to_s.length }
end

def correct_annotation?(first_word, colon, space, note)

def correct_annotation?(first_word, colon, space, note)
  keyword?(first_word) && (colon && space && note || !colon && !note)
end

def first_comment_line?(comments, ix)

def first_comment_line?(comments, ix)
  ix.zero? || comments[ix - 1].loc.line < comments[ix].loc.line - 1
end

def investigate(processed_source)

def investigate(processed_source)
  processed_source.comments.each_with_index do |comment, ix|
    next unless first_comment_line?(processed_source.comments, ix)
    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, annotation_range(comment, margin, length),
                format(note ? MSG : MISSING_NOTE, first_word))
  end
end