axe

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package axe ingests axe-core accessibility results (the JSON produced by axe.run(), as emitted by @axe-core/cli, Playwright/axe, CI reporters, etc.) and normalizes them into findingspec Findings (a11y domain, type "wcag"). It depends only on axe-core's stable JSON shape, not on any library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(r io.Reader, opts Options) (*findingspec.FindingSet, error)

Parse decodes axe-core JSON results from r and returns a normalized FindingSet.

Types

type Node

type Node struct {
	Target         []any  `json:"target"` // CSS selector(s); may nest for frames
	HTML           string `json:"html"`
	FailureSummary string `json:"failureSummary"`
	Impact         string `json:"impact"`
}

Node is one element instance a rule matched.

type Options

type Options struct {
	// IncludeIncomplete also ingests axe's "incomplete" (needs-review) results,
	// marked with confidence low and an "axe:incomplete" tag.
	IncludeIncomplete bool
}

Options configures normalization.

type Results

type Results struct {
	URL        string      `json:"url"`
	Timestamp  string      `json:"timestamp"`
	Violations []Violation `json:"violations"`
	Incomplete []Violation `json:"incomplete"`
}

Results is the top level of an axe-core run (axe.run() output).

func (Results) Findings

func (res Results) Findings(opts Options) *findingspec.FindingSet

Findings converts axe results into a findingspec.FindingSet, one finding per matched element (violation × node).

type Violation

type Violation struct {
	ID          string   `json:"id"`     // axe rule id, e.g. "color-contrast"
	Impact      string   `json:"impact"` // minor|moderate|serious|critical
	Tags        []string `json:"tags"`   // e.g. wcag2aa, wcag143, best-practice
	Description string   `json:"description"`
	Help        string   `json:"help"`
	HelpURL     string   `json:"helpUrl"`
	Nodes       []Node   `json:"nodes"`
}

Violation is one failed (or, under Incomplete, needs-review) axe rule.

Jump to

Keyboard shortcuts

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