This formatter displays the list of offended cops with a count of how many offenses of their kind were found. Ordered by desc offense count
Here's the format:
26 LineLength 3 OneLineConditional -- 29 Total
# File lib/rubocop/formatter/offense_count_formatter.rb, line 21 def file_finished(_file, offenses) offenses.each { |o| @offense_counts[o.cop_name] += 1 } end
# File lib/rubocop/formatter/offense_count_formatter.rb, line 25 def finished(_inspected_files) report_summary(@offense_counts) end
# File lib/rubocop/formatter/offense_count_formatter.rb, line 45 def ordered_offense_counts(offense_counts) Hash[offense_counts.sort_by { |k, v| [-v, k] }] end
# File lib/rubocop/formatter/offense_count_formatter.rb, line 29 def report_summary(offense_counts) per_cop_counts = ordered_offense_counts(offense_counts) total_count = total_offense_count(offense_counts) output.puts per_cop_counts.each do |cop_name, count| output.puts "#{count.to_s.ljust(total_count.to_s.length + 2)}" "#{cop_name}\n" end output.puts '--' output.puts "#{total_count} Total" output.puts end
Generated with the Darkfish Rdoc Generator 2.