report

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package report provides report generation for accessibility audits.

Index

Constants

View Source
const DefaultOpenACRCatalog = "2.5-edition-wcag-2.2-508-en"

DefaultOpenACRCatalog is the default catalog ID for generated OpenACR reports.

Variables

This section is empty.

Functions

func GenerateOpenACR added in v0.3.0

func GenerateOpenACR(result *audit.AuditResult, opts OpenACROptions) (*openacr.Report, error)

GenerateOpenACR generates an OpenACR report with custom options.

func OpenACRReportDate added in v0.3.0

func OpenACRReportDate(result *audit.AuditResult) time.Time

OpenACRReportDate returns the report date for audit results.

func ValidateOpenACRAgainstCatalog added in v0.3.0

func ValidateOpenACRAgainstCatalog(report *openacr.Report) ([]openacr.ValidationError, error)

ValidateOpenACRAgainstCatalog validates a report against its catalog.

func ValidateOpenACRReport added in v0.3.0

func ValidateOpenACRReport(report *openacr.Report) []openacr.ValidationError

ValidateOpenACRReport validates a generated OpenACR report.

Types

type ComparisonMetrics

type ComparisonMetrics struct {
	// Issue counts
	BeforeTotalIssues int `json:"beforeTotalIssues"`
	AfterTotalIssues  int `json:"afterTotalIssues"`
	IssuesFixed       int `json:"issuesFixed"`
	IssuesRemaining   int `json:"issuesRemaining"`
	NewIssues         int `json:"newIssues"` // Regressions

	// By severity
	CriticalFixed int `json:"criticalFixed"`
	SeriousFixed  int `json:"seriousFixed"`
	ModerateFixed int `json:"moderateFixed"`
	MinorFixed    int `json:"minorFixed"`

	// Conformance changes
	BeforeConformance string `json:"beforeConformance"`
	AfterConformance  string `json:"afterConformance"`

	// Per-criterion comparison
	CriteriaComparison []CriterionComparison `json:"criteriaComparison"`

	// Improvement score (0-100)
	ImprovementScore float64 `json:"improvementScore"`
}

ComparisonMetrics shows improvement/regression between versions.

type ComparisonResult

type ComparisonResult struct {
	// Metadata
	Name        string    `json:"name"`
	Description string    `json:"description,omitempty"`
	GeneratedAt time.Time `json:"generatedAt"`

	// Before (inaccessible) version
	Before *audit.AuditResult `json:"before"`

	// After (accessible) version
	After *audit.AuditResult `json:"after"`

	// Computed comparison metrics
	Comparison ComparisonMetrics `json:"comparison"`
}

ComparisonResult holds before/after audit results for comparison.

func NewComparison

func NewComparison(name string, before, after *audit.AuditResult) *ComparisonResult

NewComparison creates a comparison between before and after audit results.

type CriterionComparison

type CriterionComparison struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Level        string `json:"level"`
	BeforeStatus string `json:"beforeStatus"`
	AfterStatus  string `json:"afterStatus"`
	BeforeIssues int    `json:"beforeIssues"`
	AfterIssues  int    `json:"afterIssues"`
	Status       string `json:"status"` // fixed, improved, unchanged, regressed
}

CriterionComparison shows before/after for a single criterion.

type DemoSite

type DemoSite struct {
	Name        string
	Slug        string // Directory-safe name for output
	Description string
	BeforeURL   string
	AfterURL    string
	Source      string // Organization that created it
}

DemoSite represents a known accessibility demo site with before/after URLs.

func KnownDemoSites

func KnownDemoSites() []DemoSite

KnownDemoSites returns a list of known accessibility demo sites.

type Format

type Format string

Format represents an output format.

const (
	FormatJSON     Format = "json"
	FormatHTML     Format = "html"
	FormatMarkdown Format = "markdown"
	FormatCSV      Format = "csv"
	FormatVPAT     Format = "vpat"
	FormatWCAG     Format = "wcag"
	FormatOpenACR  Format = "openacr"
)

type OpenACROptions added in v0.3.0

type OpenACROptions struct {
	// ProductName overrides the default product name (target URL).
	ProductName string

	// ProductVersion sets the product version.
	ProductVersion string

	// AuthorName sets the author name.
	AuthorName string

	// AuthorEmail sets the author email.
	AuthorEmail string

	// VendorName sets the vendor company name.
	VendorName string

	// VendorEmail sets the vendor email.
	VendorEmail string

	// CatalogID overrides the default catalog selection.
	CatalogID string

	// IncludeAllCriteria includes all catalog criteria, not just evaluated ones.
	IncludeAllCriteria bool
}

OpenACROptions provides options for OpenACR generation.

type Writer

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

Writer writes audit results in various formats.

func NewWriter

func NewWriter(format Format) *Writer

NewWriter creates a new report writer.

func (*Writer) Write

func (w *Writer) Write(out io.Writer, result *audit.AuditResult) error

Write writes the audit result to the given writer.

func (*Writer) WriteComparison

func (w *Writer) WriteComparison(out io.Writer, result *ComparisonResult) error

WriteComparison writes a comparison report.

Jump to

Keyboard shortcuts

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