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