Class: Git::Lint::Analyzers::CommitBodyLeadingLine
- Defined in:
- lib/git/lint/analyzers/commit_body_leading_line.rb
Constant Summary
Constants inherited from Abstract
Abstract::ISSUE_LINE_OFFSET, Abstract::LEVELS
Instance Attribute Summary
Attributes inherited from Abstract
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?
Constructor Details
This class inherits a constructor from Git::Lint::Analyzers::Abstract
Class Method Details
.defaults ⇒ Object
7 8 9 10 11 12 |
# File 'lib/git/lint/analyzers/commit_body_leading_line.rb', line 7 def self.defaults { enabled: true, severity: :error } end |
Instance Method Details
#issue ⇒ Object
23 24 25 26 27 |
# File 'lib/git/lint/analyzers/commit_body_leading_line.rb', line 23 def issue return {} if valid? {hint: "Use blank line between subject and body."} end |
#valid? ⇒ Boolean
14 15 16 17 18 19 20 21 |
# File 'lib/git/lint/analyzers/commit_body_leading_line.rb', line 14 def valid? = commit. subject, body = .split "\n", 2 return true if !String(subject).empty? && String(body).strip.empty? .match?(/\A.+(\n\n|\#).+/m) end |