Documentation
¶
Overview ¶
Package report provides formatters that render a CrawlResult for human or machine consumption.
Index ¶
- func AllReporters() map[string]Reporter
- func FilterIssues(issues []model.Issue, severities, categories string) []model.Issue
- func GroupIssues(issues []model.Issue, key string) map[string][]model.Issue
- type CSVReporter
- type HTMLReporter
- type JSONLReporter
- type JSONReporter
- type JUnitReporter
- type MarkdownReporter
- type PDFReporter
- type Reporter
- type SARIFReporter
- type SummaryStats
- type TerminalReporter
- type URLIssueCount
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllReporters ¶
AllReporters returns a map of all available reporters keyed by name.
func FilterIssues ¶
FilterIssues returns only issues matching the given criteria. severities: comma-separated list of severities (e.g. "critical,warning") categories: comma-separated list of category prefixes (e.g. "seo,performance") If a filter is empty string, all issues pass that filter.
Types ¶
type CSVReporter ¶
type CSVReporter struct{}
CSVReporter writes the CrawlResult issues as a CSV document.
func (*CSVReporter) Write ¶
func (r *CSVReporter) Write(_ context.Context, result *model.CrawlResult, w io.Writer) error
Write renders the issues from result as CSV rows and writes them to w. The header row is: url,severity,check,message,detail. Issues are written in their existing order (assumed pre-sorted by severity).
type HTMLReporter ¶
type HTMLReporter struct{}
HTMLReporter writes the CrawlResult as a self-contained HTML document.
func (*HTMLReporter) Write ¶
func (r *HTMLReporter) Write(_ context.Context, result *model.CrawlResult, w io.Writer) error
Write renders result as an HTML report and writes it to w.
type JSONLReporter ¶
type JSONLReporter struct{}
JSONLReporter writes the CrawlResult as JSON Lines — one JSON object per line.
func (*JSONLReporter) Write ¶
func (r *JSONLReporter) Write(_ context.Context, result *model.CrawlResult, w io.Writer) error
Write renders result as JSONL (one JSON object per line) and writes it to w.
type JSONReporter ¶
type JSONReporter struct{}
JSONReporter writes the CrawlResult as pretty-printed JSON.
func (*JSONReporter) Write ¶
func (r *JSONReporter) Write(_ context.Context, result *model.CrawlResult, w io.Writer) error
Write serialises result as indented JSON and writes it to w.
type JUnitReporter ¶
type JUnitReporter struct{}
JUnitReporter writes the CrawlResult issues as JUnit XML.
func (*JUnitReporter) Write ¶
func (r *JUnitReporter) Write(_ context.Context, result *model.CrawlResult, w io.Writer) error
Write renders result as JUnit XML and writes it to w.
type MarkdownReporter ¶
type MarkdownReporter struct{}
MarkdownReporter writes the CrawlResult as a Markdown document.
func (*MarkdownReporter) Write ¶
func (r *MarkdownReporter) Write(_ context.Context, result *model.CrawlResult, w io.Writer) error
Write renders result as Markdown and writes it to w.
type PDFReporter ¶
type PDFReporter struct{}
PDFReporter renders a CrawlResult as a PDF document by first generating an HTML report and then printing it to PDF via a headless browser.
func (*PDFReporter) Write ¶
func (r *PDFReporter) Write(ctx context.Context, result *model.CrawlResult, w io.Writer) error
Write generates a PDF report and writes it to w. Note: each invocation launches a new headless browser instance to render the HTML-to-PDF conversion. This is intentional as the browser is short-lived and isolated per report generation.
type Reporter ¶
type Reporter interface {
// Name returns the short identifier of this reporter (e.g. "terminal").
Name() string
// Write renders result and writes the formatted output to w.
Write(ctx context.Context, result *model.CrawlResult, w io.Writer) error
}
Reporter formats and writes a CrawlResult to an output destination.
type SARIFReporter ¶
type SARIFReporter struct {
Version string
}
SARIFReporter writes the CrawlResult issues in SARIF 2.1.0 format. Set Version to override the default "dev" tool version in the output.
func (*SARIFReporter) Write ¶
func (r *SARIFReporter) Write(_ context.Context, result *model.CrawlResult, w io.Writer) error
Write renders result as SARIF 2.1.0 JSON and writes it to w.
type SummaryStats ¶
type SummaryStats struct {
TotalIssues int `json:"total_issues"`
BySeverity map[model.Severity]int `json:"by_severity"`
ByCategory map[string]int `json:"by_category"`
TopURLs []URLIssueCount `json:"top_urls"`
PagesScanned int `json:"pages_scanned"`
}
SummaryStats holds aggregated statistics about audit results.
func ComputeSummary ¶
func ComputeSummary(result *model.CrawlResult) SummaryStats
ComputeSummary calculates summary statistics from a CrawlResult.
type TerminalReporter ¶
type TerminalReporter struct{}
TerminalReporter renders a human-readable audit report to a terminal, using lipgloss for color and go-pretty for tables.
func (*TerminalReporter) Write ¶
func (r *TerminalReporter) Write(_ context.Context, result *model.CrawlResult, w io.Writer) error
Write formats result as a colourful terminal report and writes it to w.
type URLIssueCount ¶
URLIssueCount pairs a URL with its issue count.