Class: Git::Lint::Analyzers::CommitBodyLeadingLine
- Defined in:
- lib/git/lint/analyzers/commit_body_leading_line.rb
Overview
Analyzes leading line between commit subject and start of body.
Constant Summary
Constants inherited from Abstract
Abstract::BODY_OFFSET, Abstract::LEVELS
Instance Attribute Summary
Attributes inherited from Abstract
Instance Method Summary collapse
Methods inherited from Abstract
build_issue_line, #error?, id, #initialize, #invalid?, label, #severity, #warning?
Constructor Details
This class inherits a constructor from Git::Lint::Analyzers::Abstract
Instance Method Details
#issue ⇒ Object
17 18 19 20 21 |
# File 'lib/git/lint/analyzers/commit_body_leading_line.rb', line 17 def issue return {} if valid? {hint: "Use blank line between subject and body."} end |
#valid? ⇒ Boolean
8 9 10 11 12 13 14 15 |
# File 'lib/git/lint/analyzers/commit_body_leading_line.rb', line 8 def valid? raw = commit.raw subject, body = raw.split "\n", 2 return true if !String(subject).empty? && String(body).strip.empty? raw.match?(/\A.+(\n\n|\#).+/m) end |