Documentation
¶
Overview ¶
Package output provides formatting and file writing for link check reports.
Index ¶
- func FormatReport(report *Report, format Format) ([]byte, error)
- func IsValidFormat(s string) bool
- func ValidFormats() []string
- func WriteToFile(report *Report, filename string) error
- type Format
- type Formatter
- type IgnoredURL
- type JSONFormatter
- type JUnitFormatter
- type MarkdownFormatter
- type Report
- type XMLFormatter
- type YAMLFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatReport ¶
FormatReport formats a report using the specified format.
func IsValidFormat ¶
IsValidFormat checks if a format string is valid.
func WriteToFile ¶
WriteToFile writes a formatted report to a file.
Types ¶
type Format ¶
type Format string
Format represents an output format type.
const ( // FormatJSON outputs as JSON. FormatJSON Format = "json" // FormatYAML outputs as YAML. FormatYAML Format = "yaml" // FormatXML outputs as generic XML. FormatXML Format = "xml" // FormatJUnit outputs as JUnit XML for CI/CD integration. FormatJUnit Format = "junit" // FormatMarkdown outputs as a Markdown report. FormatMarkdown Format = "markdown" )
func InferFormat ¶
InferFormat determines the output format from a filename extension.
type Formatter ¶
Formatter is the interface that output formatters implement.
func GetFormatter ¶
GetFormatter returns the appropriate formatter for a format.
type IgnoredURL ¶
type IgnoredURL struct {
URL string
File string
Reason string // "domain", "pattern", or "regex"
Rule string // The rule that matched
Line int
}
IgnoredURL represents a URL that was ignored by filter rules.
type JUnitFormatter ¶
type JUnitFormatter struct{}
JUnitFormatter formats reports as JUnit XML for CI/CD integration. Only failed/error links are included as test cases.
type MarkdownFormatter ¶
type MarkdownFormatter struct{}
MarkdownFormatter formats reports as Markdown.
type Report ¶
type Report struct {
GeneratedAt time.Time
Files []string
Results []checker.Result
Ignored []IgnoredURL
Summary checker.Summary
TotalLinks int
UniqueURLs int
// Stats contains performance statistics when --stats flag is used.
// This is a map to allow flexible serialization to JSON/YAML.
Stats map[string]any `json:"stats,omitempty" yaml:"stats,omitempty"`
}
Report contains all data needed for output formatting.