Class: Git::Lint::Analyzers::CommitSubjectLength

Inherits:
Abstract
  • Object
show all
Defined in:
lib/git/lint/analyzers/commit_subject_length.rb

Overview

Analyzes commit subject length is short and concise.

Constant Summary

Constants inherited from Abstract

Abstract::BODY_OFFSET, Abstract::LEVELS

Instance Attribute Summary

Attributes inherited from Abstract

#commit

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

#issueObject



10
11
12
13
14
# File 'lib/git/lint/analyzers/commit_subject_length.rb', line 10

def issue
  return {} if valid?

  {hint: "Use #{maximum} characters or less."}
end

#valid?Boolean

Returns:

  • (Boolean)


8
# File 'lib/git/lint/analyzers/commit_subject_length.rb', line 8

def valid? = commit.subject.sub(/(fixup!|squash!)\s{1}/, "").size <= maximum