Class: Reek::Report::Base Abstract
- Inherits:
-
Object
- Object
- Reek::Report::Base
- Defined in:
- lib/reek/report/report.rb
Overview
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
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
-
#add_examiner(examiner) ⇒ Object
Add Examiner to report on.
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
-
#show ⇒ Object
Render the report results on STDOUT.
- #smells ⇒ Object private
- #smells? ⇒ Boolean private
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( = {}) @examiners = [] @total_smell_count = 0 @options = @warning_formatter = .fetch :warning_formatter, SimpleWarningFormatter.new @report_formatter = .fetch :report_formatter, Formatter @sort_by_issue_count = .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.
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 |
#show ⇒ Object
Render the report results on STDOUT
38 39 40 |
# File 'lib/reek/report/report.rb', line 38 def show raise NotImplementedError end |
#smells ⇒ Object
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.
43 44 45 |
# File 'lib/reek/report/report.rb', line 43 def smells? @total_smell_count > 0 end |