Class: Git::Lint::Analyzers::CommitSubjectLength
- Defined in:
- lib/git/lint/analyzers/commit_subject_length.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 13 |
# File 'lib/git/lint/analyzers/commit_subject_length.rb', line 7 def self.defaults { enabled: true, severity: :error, length: 72 } end |
Instance Method Details
#issue ⇒ Object
19 20 21 22 23 |
# File 'lib/git/lint/analyzers/commit_subject_length.rb', line 19 def issue return {} if valid? {hint: "Use #{length} characters or less."} end |
#valid? ⇒ Boolean
15 16 17 |
# File 'lib/git/lint/analyzers/commit_subject_length.rb', line 15 def valid? commit.subject.sub(/(fixup!|squash!)\s{1}/, "").size <= length end |