mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Refactor ExplainFormatter
a bit
This commit is contained in:
parent
c9538220c6
commit
1718945523
1 changed files with 3 additions and 8 deletions
|
@ -4,8 +4,6 @@ module Ameba::Formatter
|
|||
# A formatter that shows the detailed explanation of the issue at
|
||||
# a specific location.
|
||||
class ExplainFormatter
|
||||
HEADING_MARKER = "## "
|
||||
|
||||
include Util
|
||||
|
||||
getter output : IO::FileDescriptor | IO::Memory
|
||||
|
@ -64,10 +62,7 @@ module Ameba::Formatter
|
|||
rule.name.colorize(:magenta),
|
||||
rule.severity.to_s.colorize(rule.severity.color),
|
||||
}
|
||||
|
||||
if rule.responds_to?(:description)
|
||||
output_paragraph rule.description
|
||||
end
|
||||
output_paragraph rule.description
|
||||
|
||||
rule_doc = colorize_code_fences(rule.class.parsed_doc)
|
||||
return unless rule_doc
|
||||
|
@ -84,7 +79,7 @@ module Ameba::Formatter
|
|||
end
|
||||
|
||||
private def output_title(title)
|
||||
output << HEADING_MARKER.colorize(:yellow)
|
||||
output << "### ".colorize(:yellow)
|
||||
output << title.upcase.colorize(:yellow)
|
||||
output << "\n\n"
|
||||
end
|
||||
|
@ -95,7 +90,7 @@ module Ameba::Formatter
|
|||
|
||||
private def output_paragraph(paragraph : Array)
|
||||
paragraph.each do |line|
|
||||
output << ' ' << line << '\n'
|
||||
output << " " << line << '\n'
|
||||
end
|
||||
output << '\n'
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue