Documentation
¶
Overview ¶
Package diff compares two crawl reports and describes what changed between them: which issues are new, which were resolved, which persist, plus summary and page-set deltas.
It is a pure transform over two *report.Report values — it never fetches, reads files, or mutates anything. The CLI's `compare` command and any future scheduled-comparison feature build on this seam, mirroring how the report and sitemap packages stay side-effect free.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Diff ¶
type Diff struct {
Base Meta `json:"base"`
Current Meta `json:"current"`
Issues IssueDiff `json:"issues"`
Summary SummaryDiff `json:"summary"`
Pages PageDiff `json:"pages"`
}
Diff is the full comparison of a base report against a current one. "Base" is the earlier crawl and "current" the later one, so a resolved issue is present in base but gone in current, and a new issue is the reverse.
type IssueDiff ¶
type IssueDiff struct {
New []analyze.Issue `json:"new"` // present now, absent before (regressions / freshly found)
Resolved []analyze.Issue `json:"resolved"` // present before, absent now (fixed or no longer reached)
Persisting []analyze.Issue `json:"persisting"` // present in both crawls
}
IssueDiff buckets issues by how they changed between the two crawls. Issue identity is (analyzer, code, url); message, severity, and data may shift without changing identity, so the current-crawl copy is kept for New and Persisting and the base copy for Resolved.
type Meta ¶
type Meta struct {
Seed string `json:"seed"`
StartedAt string `json:"started_at"`
FinishedAt string `json:"finished_at"`
PagesCrawled int `json:"pages_crawled"`
}
Meta identifies one side of a comparison.
type PageDiff ¶
type PageDiff struct {
Added []string `json:"added"` // crawled now, not before
Removed []string `json:"removed"` // crawled before, not now
}
PageDiff reports which crawled URLs appeared or disappeared between the two crawls, drawn from each report's site-map entries. Nil site maps yield empty slices.
type SummaryDiff ¶
type SummaryDiff struct {
BySeverity map[string]int `json:"by_severity"`
ByAnalyzer map[string]int `json:"by_analyzer"`
ByStatus map[string]int `json:"pages_by_status"`
// NewBySeverity / ResolvedBySeverity tally the issues in IssueDiff.New / .Resolved by
// severity, the headline "what got worse / better" numbers.
NewBySeverity map[string]int `json:"new_by_severity"`
ResolvedBySeverity map[string]int `json:"resolved_by_severity"`
}
SummaryDiff reports count deltas. Each map is keyed the same way as report.Summary and holds current-minus-base, so positive means "more now". Keys present in only one side appear with the signed full count.
type TextReporter ¶
type TextReporter struct {
// MaxList caps how many issues/URLs are listed per section (0 = the default of 20).
MaxList int
}
TextReporter writes a human-readable diff for the terminal.