Sha256: c9759f3e0f82330cef9d2b5ad2297887a8b458faa5ee7d919b649a01254b1519
Contents?: true
Size: 1.76 KB
Versions: 3
Compression:
Stored size: 1.76 KB
Contents
module Reek module Cli module Report module Strategy # # Base class for report startegies. # Each gathers results according to strategy chosen # class Base attr_reader :report_formatter, :warning_formatter, :examiners def initialize(report_formatter, warning_formatter, examiners) @report_formatter = report_formatter @warning_formatter = warning_formatter @examiners = examiners end def summarize_single_examiner(examiner) result = report_formatter.header examiner if examiner.smelly? formatted_list = report_formatter.format_list examiner.smells, warning_formatter result += ":\n#{formatted_list}" end result end end # # Lists out each examiner, even if it has no smell # class Verbose < Base def gather_results examiners.each_with_object([]) do |examiner, result| result << summarize_single_examiner(examiner) end end end # # Lists only smelly examiners # class Quiet < Base def gather_results examiners.each_with_object([]) do |examiner, result| result << summarize_single_examiner(examiner) if examiner.smelly? end end end # # Lists smells without summarization # Used for yaml and html reports # class Normal < Base def gather_results examiners.each_with_object([]) { |examiner, smells| smells << examiner.smells }. flatten end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reek-1.5.1 | lib/reek/cli/report/strategy.rb |
reek-1.5.0 | lib/reek/cli/report/strategy.rb |
reek-1.4.0 | lib/reek/cli/report/strategy.rb |