Module: ImproveYourCode::Report::Formatter

Defined in:
lib/improve_your_code/report/formatter.rb,
lib/improve_your_code/report/formatter/heading_formatter.rb,
lib/improve_your_code/report/formatter/progress_formatter.rb,
lib/improve_your_code/report/formatter/simple_warning_formatter.rb

Defined Under Namespace

Modules: ProgressFormatter Classes: HeadingFormatterBase, QuietHeadingFormatter, SimpleWarningFormatter

Class Method Summary collapse

Class Method Details

.format_list(warnings, formatter: SimpleWarningFormatter.new) ⇒ Object



12
13
14
# File 'lib/improve_your_code/report/formatter.rb', line 12

def format_list(warnings, formatter: SimpleWarningFormatter.new)
  warnings.map { |warning| "  #{formatter.format(warning)}" }.join("\n")
end

.header(examiner) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/improve_your_code/report/formatter.rb', line 16

def header(examiner)
  count = examiner.smells_count
  result = Rainbow("#{examiner.description} -- ").cyan +
           Rainbow("#{count} warning").yellow
  result += Rainbow('s').yellow unless count == 1
  result
end