Sha256: 918613a6a2d0c45e5aafb9933966e9f1647ec3ecec4d30df05f559ad84c8f826
Contents?: true
Size: 929 Bytes
Versions: 5
Compression:
Stored size: 929 Bytes
Contents
# frozen_string_literal: true module Git module Lint module Analyzers class CommitBodyParagraphCapitalization < Abstract def self.defaults { enabled: true, severity: :error } end def self.invalid?(line) = line.match?(/\A[[:lower:]].+\Z/m) def valid? = lowercased_lines.empty? def issue return {} if valid? { hint: "Capitalize first word.", lines: affected_lines } end private def lowercased_lines = commit.body_paragraphs.select { |line| self.class.invalid? line } def affected_lines klass = self.class commit.body_paragraphs.each.with_object([]).with_index do |(line, lines), index| lines << klass.build_issue_line(index, line) if klass.invalid? line end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems