Class: Greener::Formatter::Summary

Inherits:
BaseFormatter show all
Defined in:
lib/greener/formatter/summary.rb

Overview

Prints summary line, e.g. “10 file(s) inspected, no offenses detected”

Instance Method Summary collapse

Methods inherited from BaseFormatter

#file_finished, #file_started, #initialize, #started

Constructor Details

This class inherits a constructor from Greener::Formatter::BaseFormatter

Instance Method Details

#finished(violations) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/greener/formatter/summary.rb', line 7

def finished(violations)
  conclusion = violations.empty? ? "no offenses detected" : "#{violations.count} offense(s) detected"

  res = "#{@files.count} file(s) inspected, #{conclusion}"
  return puts(res) if violations.empty?
  fail Greener::Error::LintFailed, res
end