Class: Git::Lint::Reporters::Commit

Inherits:
Object
  • Object
show all
Defined in:
lib/git/lint/reporters/commit.rb

Overview

Reports issues related to a single commit.

Instance Method Summary collapse

Constructor Details

#initialize(commit:, analyzers: []) ⇒ Commit

Returns a new instance of Commit.



8
9
10
11
# File 'lib/git/lint/reporters/commit.rb', line 8

def initialize commit:, analyzers: []
  @commit = commit
  @analyzers = analyzers.select(&:invalid?)
end

Instance Method Details

#to_sObject Also known as: to_str



13
14
15
16
17
18
# File 'lib/git/lint/reporters/commit.rb', line 13

def to_s
  return "" if analyzers.empty?

  "#{commit.sha} (#{commit.author_name}, #{commit.authored_relative_at}): " \
  "#{commit.subject}\n#{report}\n"
end