BaseFormatter
A basic formatter that displays only files with offenses. Offenses are displayed at compact form - just the location of the problem and the associated message.
# File lib/rubocop/formatter/simple_text_formatter.rb, line 26 def file_finished(file, offenses) return if offenses.empty? count_stats(offenses) report_file(file, offenses) end
# File lib/rubocop/formatter/simple_text_formatter.rb, line 32 def finished(inspected_files) report_summary(inspected_files.count, @total_offense_count, @total_correction_count) end
# File lib/rubocop/formatter/simple_text_formatter.rb, line 38 def report_file(file, offenses) output.puts yellow("== #{smart_path(file)} ==") offenses.each do |o| output.printf("%s:%3d:%3d: %s\n", colored_severity_code(o), o.line, o.real_column, message(o)) end end
# File lib/rubocop/formatter/simple_text_formatter.rb, line 48 def report_summary(file_count, offense_count, correction_count) summary = pluralize(file_count, 'file') summary << ' inspected, ' offenses_text = pluralize(offense_count, 'offense', no_for_zero: true) offenses_text << ' detected' summary << colorize(offenses_text, offense_count.zero? ? :green : :red) if correction_count > 0 summary << ', ' correction_text = pluralize(correction_count, 'offense') correction_text << ' corrected' color = correction_count == offense_count ? :green : :cyan summary << colorize(correction_text, color) end output.puts output.puts summary end
Generated with the Darkfish Rdoc Generator 2.