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.gsub(/^ {6}/, "") standard: Use Ruby Standard Style (https://github.com/testdouble/standard) MSG
Class Method Summary collapse
Instance Method Summary collapse
- #file_finished(file, offenses) ⇒ Object
-
#initialize(*args) ⇒ Formatter
constructor
A new instance of Formatter.
- #started(_target_files) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Formatter
Returns a new instance of Formatter.
17 18 19 20 21 22 |
# File 'lib/standard/formatter.rb', line 17 def initialize(*args) super @detects_fixability = DetectsFixability.new @header_printed_already = false @fix_suggestion_printed_already = false end |
Class Method Details
.fixable_error_message(command) ⇒ Object
11 12 13 14 15 |
# File 'lib/standard/formatter.rb', line 11 def self.(command) <<-MSG.gsub(/^ {8}/, "") standard: Run `#{command}` to automatically fix some problems. MSG end |
Instance Method Details
#file_finished(file, offenses) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/standard/formatter.rb', line 28 def file_finished(file, offenses) return unless (uncorrected_offenses = offenses.reject(&:corrected?)).any? print_header_once print_fix_suggestion_once(uncorrected_offenses) 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 |
#started(_target_files) ⇒ Object
24 25 26 |
# File 'lib/standard/formatter.rb', line 24 def started(_target_files) print_todo_warning end |