Sha256: c634fd59b8ce3e392808fbfec38261b8c8f3320f301ed6c5e5972dd565f148ee
Contents?: true
Size: 1.56 KB
Versions: 1
Compression:
Stored size: 1.56 KB
Contents
# frozen_string_literal: true require_relative 'base_report' module Reek module Report # # Generates a sorted, text summary of smells in examiners # # @public # class TextReport < BaseReport # @public def initialize(**args) super print progress_formatter.header end # @public def add_examiner(examiner) print progress_formatter.progress examiner super end # @public def show sort_examiners if smells? print progress_formatter.footer display_summary display_total_smell_count end private def smell_summaries examiners.map { |ex| summarize_single_examiner(ex) }.reject(&:empty?) end def display_summary smell_summaries.each { |smell| puts smell } end def display_total_smell_count return unless examiners.size > 1 print total_smell_count_message end def summarize_single_examiner(examiner) result = heading_formatter.header(examiner) if examiner.smelly? formatted_list = warning_formatter.format_list(examiner.smells) result += ":\n#{formatted_list}" end result end def sort_examiners examiners.sort_by!(&:smells_count).reverse! if sort_by_issue_count end def total_smell_count_message colour = smells? ? WARNINGS_COLOR : NO_WARNINGS_COLOR Rainbow("#{total_smell_count} total warning#{total_smell_count == 1 ? '' : 's'}\n").color(colour) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
reek-6.4.0 | lib/reek/report/text_report.rb |