check

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package check implements the check registry and individual site audit checks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type A11yAdvancedCheck

type A11yAdvancedCheck struct{}

A11yAdvancedCheck implements WCAG 2.1/2.2 rules beyond basics: ARIA validation, focus management, landmark completeness, color contrast hints.

type A11yCheck

type A11yCheck struct{}

A11yCheck detects accessibility violations: missing alt text, ARIA issues, heading hierarchy problems, and missing landmarks.

func (*A11yCheck) Name

func (a *A11yCheck) Name() string

func (*A11yCheck) Run

func (a *A11yCheck) Run(ctx context.Context, pages []*crawler.Page) []Finding

type AIReadyCheck

type AIReadyCheck struct{}

AIReadyCheck verifies that a site is AI-agent-friendly by checking for emerging standards and best practices that help LLMs and AI agents understand and navigate the site effectively.

Checks performed:

  • /llms.txt endpoint (emerging standard for LLM-readable site descriptions)
  • <link rel="alternate" type="text/markdown"> for markdown alternatives
  • Structured data (JSON-LD, microdata)
  • Clean semantic HTML (proper heading hierarchy, landmarks)
  • Sitemap.xml accessibility

func (*AIReadyCheck) Name

func (a *AIReadyCheck) Name() string

func (*AIReadyCheck) Run

func (a *AIReadyCheck) Run(ctx context.Context, pages []*crawler.Page) []Finding

type Checker

type Checker interface {
	Name() string
	Run(ctx context.Context, pages []*crawler.Page) []Finding
}

Checker is the interface that all checks implement.

type Finding

type Finding struct {
	Severity Severity
	URL      string
	Element  string
	Message  string
	Fix      string
	Evidence string
}

Finding is an internal finding produced by a check.

func RunAdvancedA11y

func RunAdvancedA11y(ctx context.Context, pages []*crawler.Page) []Finding

RunAdvancedA11y runs the advanced accessibility checks on a set of pages. This is called by the A11yCheck.Run as an extension.

type FormsCheck

type FormsCheck struct{}

FormsCheck detects form-related issues: missing actions, CSRF tokens, method problems.

func (*FormsCheck) Name

func (f *FormsCheck) Name() string

func (*FormsCheck) Run

func (f *FormsCheck) Run(ctx context.Context, pages []*crawler.Page) []Finding

type LinksCheck

type LinksCheck struct {
	// AcceptedStatusCodes is the set of HTTP status codes considered acceptable.
	// If empty, defaults to 200-399.
	AcceptedStatusCodes []int
}

LinksCheck detects broken links, redirect chains, and dead anchors.

func (*LinksCheck) Name

func (l *LinksCheck) Name() string

func (*LinksCheck) Run

func (l *LinksCheck) Run(ctx context.Context, pages []*crawler.Page) []Finding

type PerfCheck

type PerfCheck struct{}

PerfCheck detects performance issues: large resources, render-blocking scripts, missing compression, excessive DOM size.

func (*PerfCheck) Name

func (p *PerfCheck) Name() string

func (*PerfCheck) Run

func (p *PerfCheck) Run(ctx context.Context, pages []*crawler.Page) []Finding

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry holds all registered checks.

func DefaultRegistry

func DefaultRegistry() *Registry

DefaultRegistry returns a registry with all built-in checks.

func (*Registry) All

func (r *Registry) All() []Checker

All returns every registered check.

func (*Registry) Filter

func (r *Registry) Filter(enabled []string) []Checker

Filter returns only the checks whose names appear in the enabled list.

func (*Registry) Register

func (r *Registry) Register(c Checker)

Register adds a check to the registry.

type SEOCheck

type SEOCheck struct{}

SEOCheck detects SEO issues: missing meta tags, duplicate titles, missing canonical URLs, and robots directives.

func (*SEOCheck) Name

func (s *SEOCheck) Name() string

func (*SEOCheck) Run

func (s *SEOCheck) Run(ctx context.Context, pages []*crawler.Page) []Finding

type SRICheck

type SRICheck struct{}

SRICheck validates that cross-origin scripts and stylesheets have Subresource Integrity (SRI) attributes with strong hashes.

func (*SRICheck) Name

func (s *SRICheck) Name() string

func (*SRICheck) Run

func (s *SRICheck) Run(ctx context.Context, pages []*crawler.Page) []Finding

type SecurityCheck

type SecurityCheck struct{}

SecurityCheck detects missing security headers, mixed content, and exposed secrets.

func (*SecurityCheck) Name

func (s *SecurityCheck) Name() string

func (*SecurityCheck) Run

func (s *SecurityCheck) Run(ctx context.Context, pages []*crawler.Page) []Finding

type Severity

type Severity int

Severity mirrors the public Severity type for internal use.

const (
	SeverityInfo Severity = iota
	SeverityLow
	SeverityMedium
	SeverityHigh
	SeverityCritical
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL