class RuboCop::Formatter::SimpleTextFormatter::Report

A helper class for building the report summary text.

def correctable

def correctable
  if @safe_auto_correct
    text = pluralize(@correctable_count, 'more offense')
    "#{colorize(text, :yellow)} can be corrected with `rubocop -A`"
  else
    text = pluralize(@correctable_count, 'offense')
    "#{colorize(text, :yellow)} auto-correctable"
  end
end

def corrections

def corrections
  text = pluralize(@correction_count, 'offense')
  color = @correction_count == @offense_count ? :green : :cyan
  colorize(text, color)
end

def files

def files
  pluralize(@file_count, 'file')
end

def initialize(

rubocop:disable Metrics/ParameterLists
def initialize(
  file_count, offense_count, correction_count, correctable_count, rainbow,
  safe_auto_correct: false
)
  @file_count = file_count
  @offense_count = offense_count
  @correction_count = correction_count
  @correctable_count = correctable_count
  @rainbow = rainbow
  @safe_auto_correct = safe_auto_correct
end

def offenses

def offenses
  text = pluralize(@offense_count, 'offense', no_for_zero: true)
  color = @offense_count.zero? ? :green : :red
  colorize(text, color)
end

def summary

def summary
  if @correction_count.positive?
    if @correctable_count.positive?
      "#{files} inspected, #{offenses} detected, #{corrections} corrected,"\
        " #{correctable}"
    else
      "#{files} inspected, #{offenses} detected, #{corrections} corrected"
    end
  elsif @correctable_count.positive?
    "#{files} inspected, #{offenses} detected, #{correctable}"
  else
    "#{files} inspected, #{offenses} detected"
  end
end