Sha256: 1dbf9f50b943ba0016164b565e4a71cb0deefb2a1d715f4bef4b1b23dff2bfe1

Contents?: true

Size: 988 Bytes

Versions: 1

Compression:

Stored size: 988 Bytes

Contents

require 'delegate' # This shouldn't (?) be required - should be autoloaded, but apparently isn't

module Pluginscan
  # Print a findings report for an individual file
  class FileIssuesPrinter < Printer
    def initialize(hide_ignores, output = $stdout)
      @hide_ignores = hide_ignores
      @output = output
    end

    def print(file, checks_findings)
      return if checks_findings.empty?

      @output.puts FileView.new(file).file_path
      print_findings(checks_findings)
      # Doesn't need a blank line: each block of findings ends with a blank line
    end

  private

    def print_findings(checks_findings)
      printer = CheckFindingsPrinter.new(@output)
      checks_findings.each do |check_findings|
        findings = check_findings.findings
        findings.reject!(&:ignored) if @hide_ignores
        printer.print(check_findings.check, findings)
      end
    end
  end

  class FileView < SimpleDelegator
    def file_path
      color(:green)
    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/file_issues_printer.rb