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
- CALL_TO_ACTION_MESSAGE =
<<-MSG.gsub(/^ {6}/, "") Notice: Disagree with these rules? While StandardRB is pre-1.0.0, feel free to submit suggestions to: https://github.com/testdouble/standard/issues/new MSG
Class Method Summary collapse
Instance Method Summary collapse
- #file_finished(file, offenses) ⇒ Object
- #finished(_) ⇒ 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.
22 23 24 25 26 27 28 |
# File 'lib/standard/formatter.rb', line 22 def initialize(*args) super @detects_fixability = DetectsFixability.new @header_printed_already = false @fix_suggestion_printed_already = false @any_uncorrected_offenses = false end |
Class Method Details
.fixable_error_message(command) ⇒ Object
16 17 18 19 20 |
# File 'lib/standard/formatter.rb', line 16 def self.(command) <<-MSG.gsub(/^ {8}/, "") standard: Run `#{command}` to automatically fix some problems. MSG end |
Instance Method Details
#file_finished(file, offenses) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/standard/formatter.rb', line 34 def file_finished(file, offenses) return unless (uncorrected_offenses = offenses.reject(&:corrected?)).any? @any_uncorrected_offenses = true 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 |
#finished(_) ⇒ Object
46 47 48 |
# File 'lib/standard/formatter.rb', line 46 def finished(_) print_call_for_feedback if @any_uncorrected_offenses end |
#started(_target_files) ⇒ Object
30 31 32 |
# File 'lib/standard/formatter.rb', line 30 def started(_target_files) print_todo_warning end |