Class: Git::Lint::Analyzers::CommitBodyIssueTrackerLink

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

Constant Summary

Constants inherited from Abstract

Abstract::ISSUE_LINE_OFFSET, Abstract::LEVELS

Instance Attribute Summary

Attributes inherited from Abstract

#commit

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

.defaultsObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/git/lint/analyzers/commit_body_issue_tracker_link.rb', line 7

def self.defaults
  {
    enabled: true,
    severity: :error,
    excludes: [
      "(f|F)ix(es|ed)?\\s\\#\\d+",
      "(c|C)lose(s|d)?\\s\\#\\d+",
      "(r|R)esolve(s|d)?\\s\\#\\d+",
      "github\\.com\\/.+\\/issues\\/\\d+"
    ]
  }
end

Instance Method Details

#issueObject



24
25
26
27
28
29
30
31
# File 'lib/git/lint/analyzers/commit_body_issue_tracker_link.rb', line 24

def issue
  return {} if valid?

  {
    hint: "Explain issue instead of using link. Avoid: #{filter_list.to_hint}.",
    lines: affected_commit_body_lines
  }
end

#valid?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/git/lint/analyzers/commit_body_issue_tracker_link.rb', line 20

def valid?
  commit.body_lines.none? { |line| invalid_line? line }
end