report

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const JSONSchemaVersion = "1"

JSONSchemaVersion is the current JSON output schema version. Increment when making breaking changes to the JSON output format.

Variables

This section is empty.

Functions

func HasFailures

func HasFailures(s Summary) bool

HasFailures returns true when errors or critical findings exist.

func PassLabel

func PassLabel() string

PassLabel returns PASS when severity is info-only success marker.

Types

type Finding

type Finding struct {
	ID          string   `json:"id"`
	Name        string   `json:"name,omitempty"`
	Category    string   `json:"category"`
	Severity    Severity `json:"severity"`
	File        string   `json:"file,omitempty"`
	Line        int      `json:"line,omitempty"`
	Column      int      `json:"column,omitempty"`
	Message     string   `json:"message"`
	Explanation string   `json:"explanation,omitempty"`
	Suggestion  string   `json:"suggestion,omitempty"`
}

Finding is a single diagnostic from any ForgeKit command.

func UniqueFindings added in v0.3.0

func UniqueFindings(findings []Finding) []Finding

UniqueFindings removes duplicate findings while preserving order.

type Result

type Result struct {
	SchemaVersion string    `json:"schema_version"`
	Tool          string    `json:"tool"`
	Version       string    `json:"version"`
	Command       string    `json:"command"`
	Project       string    `json:"project,omitempty"`
	Timestamp     time.Time `json:"timestamp"`
	Summary       Summary   `json:"summary"`
	Findings      []Finding `json:"findings"`
}

Result is the stable JSON schema for machine-readable output. Used by analyze, doctor, check commands.

type Score added in v0.3.0

type Score struct {
	Categories map[string]int `json:"categories"`
	Global     int            `json:"global"`
	Notes      []string       `json:"notes,omitempty"`
}

Score represents per-category scoring and global score.

func ComputeScore added in v0.3.0

func ComputeScore(res Result) Score

ComputeScore computes simple category scores based on findings and project files. It uses deterministic rules and avoids magic numbers scattered in code.

type Severity

type Severity string

Severity levels shared by doctor, analyze and check.

const (
	SeverityInfo     Severity = "info"
	SeverityWarning  Severity = "warning"
	SeverityError    Severity = "error"
	SeverityCritical Severity = "critical"
)

func (Severity) LegacySeverity

func (s Severity) LegacySeverity() string

LegacySeverity maps to PASS/WARNING/ERROR/INFO display labels.

type Summary

type Summary struct {
	Pass     int `json:"pass"`
	Info     int `json:"info"`
	Warning  int `json:"warning"`
	Error    int `json:"error"`
	Critical int `json:"critical"`
}

func BuildSummary

func BuildSummary(findings []Finding) Summary

BuildSummary counts findings by severity.

Jump to

Keyboard shortcuts

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