Help us shape the future of Go! Take the 2026 Go Developer Survey

report

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package report renders findings as text, JSON, SARIF, CSV or JUnit XML.

Index

Constants

View Source
const ConfidenceScale = "" /* 170-byte string literal not displayed */

Write renders findings in the given format. ConfidenceScale describes the confidence field for report consumers.

Variables

View Source
var Formats = []string{"text", "json", "sarif", "csv", "junit", "stats"}

Formats lists supported report formats.

Functions

func CSV

func CSV(w io.Writer, fs []detect.Finding) error

CSV writes one row per finding.

func JSON

func JSON(w io.Writer, fs []detect.Finding) error

JSON writes a gitleaks-compatible JSON array.

func JUnit

func JUnit(w io.Writer, fs []detect.Finding) error

JUnit writes one failing test case per finding.

func PolicyLine

func PolicyLine(fs []detect.Finding, policy string, hidden int, suppressed map[string]int) string

PolicyLine summarizes what blocks, what needs review and what filters removed, so nothing is silently dropped.

func SARIF

func SARIF(w io.Writer, fs []detect.Finding, rules []*config.CompiledRule, version string) error

SARIF writes a SARIF 2.1.0 log (GitHub code scanning, ADO, Defender).

func Stats

func Stats(w io.Writer, fs []detect.Finding, version, policy string) error

Stats writes a StatsReport.

func Summary

func Summary(fs []detect.Finding) string

Summary returns a one-line count by severity.

func Text

func Text(w io.Writer, fs []detect.Finding, o Options) error

Text writes a human-readable report.

func Write

func Write(w io.Writer, format string, fs []detect.Finding, rules []*config.CompiledRule, version string, o Options) error

Types

type Options

type Options struct {
	Color       bool
	Remediation string // text: short (default) | full | none
	Policy      string // strict | balanced: text output groups non-blocking findings for review
	Explain     bool   // print the evidence for every finding (git hooks: explain every block)
}

Options control rendering.

type StatsReport

type StatsReport struct {
	Schema       int            `json:"schema"`
	Version      string         `json:"version"`
	Policy       string         `json:"policy"`
	Findings     int            `json:"findings"`
	Blocking     int            `json:"blocking"`
	ByRule       map[string]int `json:"byRule"`
	ByConfidence map[string]int `json:"byConfidence"`
	ByFileType   map[string]int `json:"byFileType"` // extension only, e.g. ".py"
}

StatsReport is an anonymized summary for sharing results publicly (for example in a benchmark issue): counts only. It contains no file paths, secret values, fingerprints, line numbers or commit data.

Jump to

Keyboard shortcuts

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