lib/git/lint/reporters/branch.rb in git-lint-2.4.0 vs lib/git/lint/reporters/branch.rb in git-lint-3.0.0

- old
+ new

@@ -5,11 +5,11 @@ module Git module Lint module Reporters # Reports issues related to a single branch. class Branch - using GitPlus::Refinements::Strings + using ::Refinements::Strings def initialize collector: Collector.new, colorizer: Pastel.new @collector = collector @colorizer = colorizer end @@ -17,10 +17,12 @@ def to_s "Running #{Identity::LABEL}...#{branch_report}\n" \ "#{commit_total}. #{issue_totals}.\n" end + alias to_str to_s + private attr_reader :collector, :colorizer def branch_report @@ -29,16 +31,17 @@ "\n\n#{commit_report}".chomp end def commit_report collector.to_h.reduce "" do |details, (commit, analyzers)| - details + Commit.new(commit: commit, analyzers: analyzers).to_s + details + Commit.new(commit:, analyzers:) end end def commit_total - %(#{"commit".pluralize count: collector.total_commits} inspected) + total = collector.total_commits + %(#{total} #{"commit".pluralize "s", count: total} inspected) end def issue_totals if collector.issues? "#{issue_total} detected (#{warning_total}, #{error_total})" @@ -47,20 +50,23 @@ end end def issue_total color = collector.errors? ? :red : :yellow - colorizer.public_send color, "issue".pluralize(count: collector.total_issues) + total = collector.total_issues + colorizer.public_send color, "#{total} issue".pluralize("s", count: total) end def warning_total color = collector.warnings? ? :yellow : :green - colorizer.public_send color, "warning".pluralize(count: collector.total_warnings) + total = collector.total_warnings + colorizer.public_send color, "#{total} warning".pluralize("s", count: total) end def error_total color = collector.errors? ? :red : :green - colorizer.public_send color, "error".pluralize(count: collector.total_errors) + total = collector.total_errors + colorizer.public_send color, "#{total} error".pluralize("s", count: total) end end end end end