Class: Reek::Report::Base Abstract

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

Overview

This class is abstract.

Subclass and override #show to create a concrete report class.

A report that contains the smells and smell counts following source code analysis.

Direct Known Subclasses

HTMLReport, JSONReport, TextReport, XMLReport, YAMLReport

Constant Summary collapse

NO_WARNINGS_COLOR =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:green
WARNINGS_COLOR =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:red

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Returns a new instance of Base.



18
19
20
21
22
23
24
25
# File 'lib/reek/report/report.rb', line 18

def initialize(options = {})
  @examiners           = []
  @total_smell_count   = 0
  @options             = options
  @warning_formatter   = options.fetch :warning_formatter, SimpleWarningFormatter.new
  @report_formatter    = options.fetch :report_formatter, Formatter
  @sort_by_issue_count = options.fetch :sort_by_issue_count, false
end

Instance Method Details

#add_examiner(examiner) ⇒ Object

Add Examiner to report on. The report will output results for all added examiners.

Parameters:



31
32
33
34
35
# File 'lib/reek/report/report.rb', line 31

def add_examiner(examiner)
  @total_smell_count += examiner.smells_count
  @examiners << examiner
  self
end

#showObject

Render the report results on STDOUT

Raises:

  • (NotImplementedError)


38
39
40
# File 'lib/reek/report/report.rb', line 38

def show
  raise NotImplementedError
end

#smellsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



48
49
50
# File 'lib/reek/report/report.rb', line 48

def smells
  @examiners.map(&:smells).flatten
end

#smells?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


43
44
45
# File 'lib/reek/report/report.rb', line 43

def smells?
  @total_smell_count > 0
end