report

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package report formats scan results for humans (colored text) and machines (JSON), and centralizes exit-code decisions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintJSON

func PrintJSON(w io.Writer, r Result) error

PrintJSON writes the machine-readable report to w.

func PrintText

func PrintText(w io.Writer, r Result, noColor bool)

PrintText writes a human-friendly, colored report to w.

Types

type Finding

type Finding struct {
	Severity Severity `json:"severity"`
	File     string   `json:"file"`
	Line     int      `json:"line,omitempty"`
	Rule     string   `json:"rule"`
	Message  string   `json:"message"`
}

Finding is a single issue (or informational OK) discovered during a scan.

type Result

type Result struct {
	Findings   []Finding `json:"findings"`
	FilesCount int       `json:"files_scanned"`
}

Result is the full output of a scan, ready to be rendered.

func (Result) ExitCode

func (r Result) ExitCode(minSeverity Severity) int

ExitCode returns 1 if the highest finding severity meets or exceeds minSeverity, else 0. This is what backs --strict / severity_exit_code.

func (Result) HighestSeverity

func (r Result) HighestSeverity() Severity

HighestSeverity returns the most severe finding in the result, or SeverityOK if there are none.

type Severity

type Severity string

Severity levels, ordered from least to most severe. The numeric Rank is what makes --strict / severity_exit_code comparisons simple.

const (
	SeverityOK       Severity = "ok"
	SeverityLow      Severity = "low"
	SeverityMedium   Severity = "medium"
	SeverityHigh     Severity = "high"
	SeverityCritical Severity = "critical"
)

func (Severity) Rank

func (s Severity) Rank() int

Rank returns a comparable integer for severity ordering.

Jump to

Keyboard shortcuts

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