Class: Git::Lint::Analyzers::CommitBodyParagraphCapitalization
- Inherits:
-
Abstract
- Object
- Abstract
- Git::Lint::Analyzers::CommitBodyParagraphCapitalization
show all
- Defined in:
- lib/git/lint/analyzers/commit_body_paragraph_capitalization.rb
Constant Summary
Constants inherited
from Abstract
Abstract::ISSUE_LINE_OFFSET, Abstract::LEVELS
Instance Attribute Summary
Attributes inherited from Abstract
#commit
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Abstract
build_issue_line, descendants, #enabled?, #error?, id, inherited, #initialize, #invalid?, label, #severity, #warning?
Class Method Details
.defaults ⇒ Object
7
8
9
10
11
12
|
# File 'lib/git/lint/analyzers/commit_body_paragraph_capitalization.rb', line 7
def self.defaults
{
enabled: true,
severity: :error
}
end
|
.invalid?(line) ⇒ Boolean
14
15
16
|
# File 'lib/git/lint/analyzers/commit_body_paragraph_capitalization.rb', line 14
def self.invalid? line
line.match?(/\A[[:lower:]].+\Z/m)
end
|
Instance Method Details
#issue ⇒ Object
22
23
24
25
26
27
28
29
|
# File 'lib/git/lint/analyzers/commit_body_paragraph_capitalization.rb', line 22
def issue
return {} if valid?
{
hint: "Capitalize first word.",
lines: affected_lines
}
end
|
#valid? ⇒ Boolean
18
19
20
|
# File 'lib/git/lint/analyzers/commit_body_paragraph_capitalization.rb', line 18
def valid?
lowercased_lines.empty?
end
|