class Git::Cop::Reporters::Commit

Reports issues related to a single commit.

Attributes

commit[R]
cops[R]

Public Class Methods

new(commit:, cops: []) click to toggle source
# File lib/git/cop/reporters/commit.rb, line 8
def initialize commit:, cops: []
  @commit = commit
  @cops = cops.select(&:invalid?)
end

Public Instance Methods

to_s() click to toggle source
# File lib/git/cop/reporters/commit.rb, line 13
def to_s
  return "" if cops.empty?
  "#{commit.sha} (#{commit.author_name}, #{commit.author_date_relative}): " \
  "#{commit.subject}\n#{cop_report}\n"
end

Private Instance Methods

cop_report() click to toggle source
# File lib/git/cop/reporters/commit.rb, line 23
def cop_report
  cops.reduce("") { |report, cop| report + Cop.new(cop).to_s }
end