Documentation
¶
Overview ¶
Package report builds and serializes crawl reports (JSON, CSV, and HTML).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Explanations ¶ added in v0.6.0
func Explanations() map[string]Explanation
Explanations returns a copy of every registered issue-code explanation, keyed by Code. It backs the web API's /api/explanations endpoint, which lets the live report view show the same what/impact/fix text as the HTML report without duplicating this map in the frontend. Returns a copy so a caller can't mutate the package's single source of truth.
Types ¶
type Explanation ¶
type Explanation struct {
// What the issue entails — a plain-language description of the finding.
What string `json:"what"`
// Impact — why it matters / the potential consequence if left unaddressed.
Impact string `json:"impact"`
// Fix — the recommended remediation.
Fix string `json:"fix"`
}
Explanation describes a single issue code in plain language: what the finding means, why it matters, and what to do about it. It is keyed by an Issue's Code and surfaced in the HTML report so a reader can act on a finding without consulting external documentation.
type HTMLReporter ¶
type HTMLReporter struct{}
HTMLReporter writes a self-contained HTML report (inline CSS, no external assets) suitable for opening in a browser or sharing as an artifact.
type Report ¶
type Report struct {
Seed string `json:"seed"`
StartedAt string `json:"started_at"`
FinishedAt string `json:"finished_at"`
PagesCrawled int `json:"pages_crawled"`
Summary Summary `json:"summary"`
Issues []analyze.Issue `json:"issues"`
// Notes carries human-readable advisories about the run itself (e.g. analyzers skipped
// because of a conflicting option), not page findings. Omitted when empty.
Notes []string `json:"notes,omitempty"`
// Coverage reports whether the crawl reached every in-scope URL it found. When it didn't,
// findings that depend on fetching a page (broken links especially) may be incomplete, and
// the HTML report shows a banner saying so. A pointer so re-rendering an older JSON report
// that predates this field doesn't falsely claim partial coverage.
Coverage *crawler.Coverage `json:"coverage,omitempty"`
// SiteMap is the crawled site as a tree, annotated with the issues found on each page. It
// powers the "Site map" tab of the HTML report and the optional sitemap.xml side output.
// It is serialized so a JSON report is a complete artifact that `gocrawl render` can turn
// back into HTML (including the Site map tab) without recrawling.
SiteMap *sitemapgen.Map `json:"site_map,omitempty"`
}
Report is the serializable result of a crawl plus analysis.
func (*Report) SummaryLines ¶
SummaryLines returns a short human-readable summary for stderr.