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 collapse
- PATTERN =
/ \A # Search start. (?! # Negative lookahead start. (?: # Non-capture group start. audio # Ignore audio. | # Or. image # Ignore image. | # Or. video # Ignore video. ) # Non-capture group end. :: # Suffix. | # Or. link: # Ignore link. | # Or. xref: # Ignore xref. ) # Negative lookahead end. [[:lower:]] # Match lowercase letters. .+ # Match one or more characters. \Z # Search end. /mx
Constants inherited from Abstract
Abstract::BODY_OFFSET, Abstract::LEVELS
Instance Attribute Summary
Attributes inherited from Abstract
Instance Method Summary collapse
-
#initialize(commit, pattern: PATTERN) ⇒ 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(commit, pattern: PATTERN) ⇒ CommitBodyParagraphCapitalization
Returns a new instance of CommitBodyParagraphCapitalization.
29 30 31 32 |
# File 'lib/git/lint/analyzers/commit_body_paragraph_capitalization.rb', line 29 def initialize(commit, pattern: PATTERN, **) super(commit, **) @pattern = pattern end |
Instance Method Details
#issue ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/git/lint/analyzers/commit_body_paragraph_capitalization.rb', line 36 def issue return {} if valid? { hint: "Capitalize first word.", lines: affected_lines } end |
#valid? ⇒ Boolean
34 |
# File 'lib/git/lint/analyzers/commit_body_paragraph_capitalization.rb', line 34 def valid? = invalids.empty? |