Class: Reek::Report::HeadingFormatterBase Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/reek/report/heading_formatter.rb

Overview

This class is abstract.

Override #show_header? to implement a heading formatter.

Base class for heading formatters. Is responsible for formatting the heading emitted for each examiner

Instance Method Summary collapse

Instance Method Details

#formatted_header(examiner) ⇒ Object (private)



26
27
28
29
30
31
32
# File 'lib/reek/report/heading_formatter.rb', line 26

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

#header(examiner) ⇒ Object



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

def header(examiner)
  if show_header?(examiner)
    formatted_header examiner
  else
    ''
  end
end

#show_header?(_examiner) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


12
13
14
# File 'lib/reek/report/heading_formatter.rb', line 12

def show_header?(_examiner)
  raise NotImplementedError
end