class Git::Cop::Reporters::Branch
Reports issues related to a single feature branch.
Attributes
collector[R]
colorizer[R]
Public Class Methods
new(collector: Collector.new, colorizer: Pastel.new)
click to toggle source
# File lib/git/cop/reporters/branch.rb, line 12 def initialize collector: Collector.new, colorizer: Pastel.new @collector = collector @colorizer = colorizer end
Public Instance Methods
to_s()
click to toggle source
# File lib/git/cop/reporters/branch.rb, line 17 def to_s "Running #{Identity.label}...#{branch_report}\n" \ "#{commit_total}. #{issue_totals}.\n" end
Private Instance Methods
branch_report()
click to toggle source
# File lib/git/cop/reporters/branch.rb, line 32 def branch_report return "" unless collector.issues? "\n\n#{commit_report}".chomp "\n" end
commit_report()
click to toggle source
# File lib/git/cop/reporters/branch.rb, line 26 def commit_report collector.to_h.reduce("") do |details, (commit, cops)| details + Commit.new(commit: commit, cops: cops).to_s end end
commit_total()
click to toggle source
# File lib/git/cop/reporters/branch.rb, line 37 def commit_total %(#{"commit".pluralize count: collector.total_commits} inspected) end
error_total()
click to toggle source
# File lib/git/cop/reporters/branch.rb, line 51 def error_total color = collector.errors? ? :red : :green colorizer.public_send color, "error".pluralize(count: collector.total_errors) end
issue_total()
click to toggle source
# File lib/git/cop/reporters/branch.rb, line 41 def issue_total color = collector.errors? ? :red : :yellow colorizer.public_send color, "issue".pluralize(count: collector.total_issues) end
issue_totals()
click to toggle source
# File lib/git/cop/reporters/branch.rb, line 56 def issue_totals if collector.issues? "#{issue_total} detected (#{warning_total}, #{error_total})" else colorizer.green("0 issues") + " detected" end end
warning_total()
click to toggle source
# File lib/git/cop/reporters/branch.rb, line 46 def warning_total color = collector.warnings? ? :yellow : :green colorizer.public_send color, "warning".pluralize(count: collector.total_warnings) end