class FitCommit::Validators::Tense

Constants

VERB_BLACKLIST

Public Instance Methods

starts_with_blacklisted_verb?(text) click to toggle source
# File lib/fit_commit/validators/tense.rb, line 73
def starts_with_blacklisted_verb?(text)
  first_word = text.split.first(2).detect { |w| w =~ /\A\w/ }
  first_word && VERB_BLACKLIST.include?(first_word.downcase)
end
validate_line(lineno, text) click to toggle source
# File lib/fit_commit/validators/tense.rb, line 67
def validate_line(lineno, text)
  if lineno == 1 && starts_with_blacklisted_verb?(text)
    add_error(lineno, "Message must use imperative present tense.")
  end
end