Class: Standard::Formatter
- Inherits:
-
RuboCop::Formatter::BaseFormatter
- Object
- RuboCop::Formatter::BaseFormatter
- Standard::Formatter
- Defined in:
- lib/standard/formatter.rb
Constant Summary collapse
- STANDARD_GREETING =
<<~MSG standard: Use Ruby Standard Style (https://github.com/standardrb/standard) MSG
Instance Method Summary collapse
- #file_finished(file, offenses) ⇒ Object
- #finished(_inspected_files) ⇒ Object
- #started(_target_files) ⇒ Object
- #track_stats(offenses) ⇒ Object
Instance Method Details
#file_finished(file, offenses) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/standard/formatter.rb', line 18 def file_finished(file, offenses) track_stats(offenses) if (uncorrected_offenses = offenses.reject(&:corrected?)).any? print_header_once uncorrected_offenses.each do |o| output.printf(" %s:%d:%d: %s\n", path_to(file), o.line, o.real_column, o..tr("\n", " ")) end end end |
#finished(_inspected_files) ⇒ Object
37 38 39 40 |
# File 'lib/standard/formatter.rb', line 37 def finished(_inspected_files) print_fix_suggestion print_todo_congratulations end |
#started(_target_files) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/standard/formatter.rb', line 10 def started(_target_files) @header_printed_already = false @total_correction_count = 0 @total_correctable_count = 0 @total_uncorrected_count = 0 print_todo_warning end |
#track_stats(offenses) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/standard/formatter.rb', line 30 def track_stats(offenses) corrected = offenses.count(&:corrected?) @total_correction_count += corrected @total_correctable_count += offenses.count(&:correctable?) - corrected @total_uncorrected_count += offenses.count - corrected end |