module AnalyseReport
AnalyseReport โ shared IRC card for paint/theme rule validation results. Public: card, format_finding Depends: IrcReply Tests: test/lib/analyse_report_test.rb
Constants
- MAX_LINES
Public Instance Methods
Source
# File lib/analyse_report.rb, line 15 def card(result, tag:, footer_hint: nil) findings = Array(result[:findings]) body = findings.first(MAX_LINES).map { |entry| format_finding(entry) } remaining = findings.length - body.length body << "... +#{remaining} more" if remaining.positive? counts = result[:counts] || {} ok_count = counts[:ok] || 0 error_count = counts[:error] || 0 warn_count = counts[:warn] || 0 footer = ["#{ok_count} ok ยท #{error_count} errors"] footer << "#{warn_count} warn" if warn_count.positive? footer << (footer_hint || "!theme use #{result[:theme_id]}") IrcReply.card( tag: tag, title: "#{result[:theme_id]} analysis", body_lines: body, footer_parts: footer ) end
Source
# File lib/analyse_report.rb, line 37 def format_finding(entry) if entry[:plugin] "#{entry[:plugin]} #{entry[:line]}:#{entry[:pos]} โ #{entry[:status]} โ #{entry[:detail]}" else "#{entry[:status]} โ #{entry[:detail]}" end end