Class: HamlLint::Reporter::OffenseCountReporter
- Inherits:
-
HamlLint::Reporter
- Object
- HamlLint::Reporter
- HamlLint::Reporter::OffenseCountReporter
- Defined in:
- lib/haml_lint/reporter/offense_count_reporter.rb
Overview
Outputs the a list of lints with a count of how many of each were found. Ordered by descending count
Instance Method Summary collapse
Methods inherited from HamlLint::Reporter
available, available?, cli_name, descendants, inherited, #initialize
Methods included from Hooks
#added_lint, #finished_file, #start
Constructor Details
This class inherits a constructor from HamlLint::Reporter
Instance Method Details
#display_report(report) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/haml_lint/reporter/offense_count_reporter.rb', line 7 def display_report(report) lints = report.lints total_count = lints.count return if total_count.zero? lints.group_by { |l| lint_type_group(l) } .transform_values(&:size) .sort_by { |_linter, lint_count| -lint_count } .each do |linter, lint_count| log.log "#{lint_count.to_s.ljust(total_count.to_s.length + 2)} #{linter}" end log.log '--' log.log "#{total_count} Total" end |