Sha256: c23a82323dd0d3b8449c92cd300f7ebb77dc24681ebb4f17c18a70d9b40718bb

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require 'pluginscan/printer'
require 'pluginscan/reports/issues_report/issues_printer/file_issues_printer'
require 'pluginscan/reports/issues_report/issues_printer/check_findings_printer'
require 'pluginscan/reports/issues_report/issues_printer/finding_printer'

module Pluginscan
  class IssuesPrinter < Printer
    def initialize(hide_ignores, output = $stdout)
      @hide_ignores = hide_ignores
      @output = output
    end

    def print(data)
      issues = data[:issues]
      file_count = data[:file_count]
      print_headline(issues, file_count)
      print_results(issues)
    end

  private

    def print_headline(issues, file_count)
      @output.puts "Scanned #{issues.scanned_files_count} out of #{file_count} files and found #{issues.found_problems_count} things:".color(:blue)
    end

    def print_results(issues)
      printer = FileIssuesPrinter.new(@hide_ignores, @output)
      issues.each do |file, findings|
        findings = findings.reject(&:all_ignored?) if @hide_ignores
        printer.print(file, findings)
      end
    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.rb