finding

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package finding defines shared structured analyzer output types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateSeverity

func ValidateSeverity(value Severity) error

ValidateSeverity accepts the three stable severities exposed by audit tools.

Types

type AuditResult

type AuditResult struct {
	Findings         []Finding        `json:"findings"`
	Total            int              `json:"total"`
	Truncated        bool             `json:"truncated"`
	CountsBySeverity map[Severity]int `json:"counts_by_severity"`
	FilesScanned     int              `json:"files_scanned"`
	DurationMS       int64            `json:"duration_ms"`
}

AuditResult is the bounded, aggregate result of an analyzer run.

func Filter

func Filter(result AuditResult, minimum Severity, limit int) AuditResult

Filter returns findings at or above min and clamps the visible findings to max. Total and CountsBySeverity describe the severity-filtered set before truncation.

type Finding

type Finding struct {
	Rule       string   `json:"rule"`
	RuleName   string   `json:"rule_name,omitempty"`
	Severity   Severity `json:"severity"`
	Location   Location `json:"location"`
	Message    string   `json:"message"`
	Suggestion string   `json:"suggestion,omitempty"`
}

Finding is one source-located analyzer diagnostic.

type Location

type Location struct {
	File string `json:"file"`
	Line int    `json:"line"`
	Col  int    `json:"col,omitempty"`
}

Location is a slash-separated source position relative to the workspace.

type Severity

type Severity string

Severity is the stable importance assigned to a finding.

const (
	// SeverityError marks a correctness or safety finding.
	SeverityError Severity = "error"
	// SeverityWarning marks a likely defect or maintainability risk.
	SeverityWarning Severity = "warning"
	// SeverityInfo marks an informational style or context finding.
	SeverityInfo Severity = "info"
)

Jump to

Keyboard shortcuts

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