Class: Reviewer::Batch::Formatter
- Inherits:
-
Object
- Object
- Reviewer::Batch::Formatter
- Includes:
- Output::Formatting
- Defined in:
- lib/reviewer/batch/formatter.rb
Overview
Display logic for batch execution: summary, run preview, missing tools
Constant Summary
Constants included from Output::Formatting
Output::Formatting::CHECKMARK, Output::Formatting::XMARK
Instance Method Summary collapse
-
#initialize(output) ⇒ Formatter
constructor
Creates a formatter for batch execution display.
-
#missing_tools(missing, tools:) ⇒ void
Displays a list of tools whose executables were not found, with install hints.
-
#no_failures_to_retry ⇒ void
Displays a message when ‘rvw failed` is used but no tools failed in the last run.
-
#no_previous_run ⇒ void
Displays a message when ‘rvw failed` is used but no previous run exists in history.
-
#run_summary(entries) ⇒ void
Displays a preview of which tools will run and their target files.
-
#summary(tool_count, seconds) ⇒ void
Displays a one-line success summary with timing and tool count.
Constructor Details
#initialize(output) ⇒ Formatter
Creates a formatter for batch execution display
18 19 20 21 |
# File 'lib/reviewer/batch/formatter.rb', line 18 def initialize(output) @output = output @printer = output.printer end |
Instance Method Details
#missing_tools(missing, tools:) ⇒ void
This method returns an undefined value.
Displays a list of tools whose executables were not found, with install hints
52 53 54 55 56 57 58 |
# File 'lib/reviewer/batch/formatter.rb', line 52 def missing_tools(missing, tools:) output.newline printer.puts(:warning, "#{missing.size} not installed:") tool_lookup = tools.to_h { |tool| [tool.key, tool] } missing.each { |result| print_missing_hint(result.tool_name, tool_lookup[result.tool_key]) } output.newline end |
#no_failures_to_retry ⇒ void
This method returns an undefined value.
Displays a message when ‘rvw failed` is used but no tools failed in the last run
63 64 65 |
# File 'lib/reviewer/batch/formatter.rb', line 63 def no_failures_to_retry printer.puts(:muted, 'No failures to retry') end |
#no_previous_run ⇒ void
This method returns an undefined value.
Displays a message when ‘rvw failed` is used but no previous run exists in history
70 71 72 |
# File 'lib/reviewer/batch/formatter.rb', line 70 def no_previous_run printer.puts(:muted, 'No previous run found') end |
#run_summary(entries) ⇒ void
This method returns an undefined value.
Displays a preview of which tools will run and their target files
40 41 42 43 44 45 |
# File 'lib/reviewer/batch/formatter.rb', line 40 def run_summary(entries) return if entries.empty? entries.each { |entry| print_run_entry(entry) } output.newline end |
#summary(tool_count, seconds) ⇒ void
This method returns an undefined value.
Displays a one-line success summary with timing and tool count
28 29 30 31 32 33 34 |
# File 'lib/reviewer/batch/formatter.rb', line 28 def summary(tool_count, seconds) output.newline printer.print(:success, CHECKMARK) printer.print(:muted, " ~#{seconds.round(1)} seconds") printer.print(:muted, " for #{tool_count} tools") if tool_count > 1 output.newline end |