class Ameba::Formatter::ExplainFormatter

Overview

A formatter that shows the detailed explanation of the issue at a specific location.

Included Modules

Defined in:

ameba/formatter/explain_formatter.cr

Constructors

Instance Method Summary

Instance methods inherited from module Ameba::Formatter::Util

affected_code(issue : Issue, context_lines = 0, max_length = 120, ellipsis = " ...", prompt = "> ")
affected_code(code, location, end_location = nil, context_lines = 0, max_length = 120, ellipsis = " ...", prompt = "> ")
affected_code
, context(lines, lineno, context_lines = 3, remove_empty = true) context, deansify(message : String | Nil) : String | Nil deansify, trim(str, max_length = 120, ellipsis = " ...") trim

Constructor Detail

def self.new(output : IO, location) #

Creates a new instance of ExplainFormatter.

Accepts output which indicates the io where the explanation will be written to. Second argument is location which indicates the location to explain.

ExplainFormatter.new output, {
  file:   path,
  line:   line_number,
  column: column_number,
}

[View source]

Instance Method Detail

def finished(sources) : Nil #

Reports the explanations at the @location.


[View source]
def location : Crystal::Location #

[View source]
def output : IO::FileDescriptor | IO::Memory #

[View source]