Sha256: 049d446a57b3419b10cd58fa1abebaf94c0e83d354b704d1af7c4d1c4fa4b264

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

module Pluginscan
  # Responsible for printing a check description and all of the
  # findings associated with that check
  class CheckFindingsPrinter < Printer
    def print(check, findings)
      return if findings.empty? && check.name != 'Encoding' # Encoding deliberately has no findings because its a file-level check. TODO: Find a better way to handle this. The benefits of filtering out findings before we try and print them are significant.

      @output.puts CheckView.new(check).title_line
      print_findings(findings)
      print_blank_line
    end

  private

    def print_findings(findings)
      printer = FindingPrinter.new(@output)
      findings.each do |finding|
        printer.print(finding)
      end
    end
  end

  # Decorate Check with view-specific methods
  class CheckView < SimpleDelegator
    def initialize(check)
      @check = check
      super
    end

    def title_line
      name = "#{@check.name}:".color(:red)
      message = @check.message.color(:yellow)

      "  #{name} #{message}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pluginscan-0.9.0 lib/pluginscan/reports/issues_report/issues_printer/check_findings_printer.rb