Sha256: 7be471f16f570ed95d3419920cdbaa11df62c32097d5577e0c0177eb187c080b
Contents?: true
Size: 921 Bytes
Versions: 1
Compression:
Stored size: 921 Bytes
Contents
module Pluginscan # Responsible for printing a single finding on the command line class FindingPrinter < Printer def print(finding) finding = FindingView.new(finding) finding = IgnoredFindingView.new(finding) if finding.ignored @output.puts finding.source_line end end class FindingView < SimpleDelegator def source_line data = { lineno: lineno, line: highlight_matches(line.strip), } # pad line number to 5. Because some plugin files really are over 10k lines format " %<lineno>5s: %{line}\n", data end private def highlight_matches(line) return line unless match # TODO: nil checks are evil! line.gsub match, match.color(:cyan) end end class IgnoredFindingView < SimpleDelegator def source_line i_symbol = "[I]".color(:red) super.gsub(/^ /, " #{i_symbol}") 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/finding_printer.rb |