Class: Evilution::Reporter::CLI::ItemFormatters::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/reporter/cli/item_formatters/error.rb

Instance Method Summary collapse

Instance Method Details

#format(result) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/evilution/reporter/cli/item_formatters/error.rb', line 6

def format(result)
  mutation = result.mutation
  header = "  #{mutation.operator_name}: #{mutation.file_path}:#{mutation.line}"
  return header unless result.error_message

  indented = result.error_message.lines.map { |line| "    #{line.chomp}" }.join("\n")
  "#{header}\n#{indented}"
end