module RuboCop::Cop::Style::AnnotationComment
def annotation?(comment)
def annotation?(comment) _margin, first_word, colon, space, note = split_comment(comment) keyword_appearance?(first_word, colon, space) && !just_first_word_of_sentence?(first_word, colon, space, note) end
def just_first_word_of_sentence?(first_word, colon, space, note)
def just_first_word_of_sentence?(first_word, colon, space, note) first_word == first_word.capitalize && !colon && space && note end
def keyword?(word)
def keyword?(word) config.for_cop('Style/CommentAnnotation')['Keywords'].include?(word) end
def keyword_appearance?(first_word, colon, space)
def keyword_appearance?(first_word, colon, space) first_word && keyword?(first_word.upcase) && (colon || space) end
def split_comment(comment)
def split_comment(comment) match = comment.text.match(/^(# ?)([A-Za-z]+)(\s*:)?(\s+)?(\S+)?/) return false unless match match.captures end