Class: Git::Lint::Analyzers::CommitBodyParagraphCapitalization
- Defined in:
- lib/git/lint/analyzers/commit_body_paragraph_capitalization.rb
Overview
Analyzes proper capitalization of commit body paragraphs.
Constant Summary
Constants inherited from Abstract
Abstract::BODY_OFFSET, Abstract::LEVELS
Instance Attribute Summary
Attributes inherited from Abstract
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ CommitBodyParagraphCapitalization
constructor
A new instance of CommitBodyParagraphCapitalization.
- #issue ⇒ Object
- #valid? ⇒ Boolean
Methods inherited from Abstract
build_issue_line, #error?, id, #invalid?, label, #severity, #warning?
Constructor Details
#initialize ⇒ CommitBodyParagraphCapitalization
Returns a new instance of CommitBodyParagraphCapitalization.
10 11 12 13 |
# File 'lib/git/lint/analyzers/commit_body_paragraph_capitalization.rb', line 10 def initialize(...) super @invalids = commit.body_paragraphs.select { |line| self.class.invalid? line } end |
Class Method Details
.invalid?(line) ⇒ Boolean
8 |
# File 'lib/git/lint/analyzers/commit_body_paragraph_capitalization.rb', line 8 def self.invalid?(line) = line.match?(/\A[[:lower:]].+\Z/m) |
Instance Method Details
#issue ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/git/lint/analyzers/commit_body_paragraph_capitalization.rb', line 17 def issue return {} if valid? { hint: "Capitalize first word.", lines: affected_lines } end |
#valid? ⇒ Boolean
15 |
# File 'lib/git/lint/analyzers/commit_body_paragraph_capitalization.rb', line 15 def valid? = invalids.empty? |