report

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package report provides rendering and export utilities for Redactyl findings, including human-readable tables and SARIF 2.1.0 output.

internal/report/sarif.go

Index

Constants

View Source
const FingerprintMetadataKey = "redactyl_fingerprint"

Variables

This section is empty.

Functions

func FilterNewFindings

func FilterNewFindings(findings []types.Finding, base Baseline) []types.Finding

func FindingKey

func FindingKey(f types.Finding) string

FindingKey returns a stable fingerprint for a finding without storing raw match text. It prefers a precomputed fingerprint in metadata when present.

func IsBaselined

func IsBaselined(f types.Finding, items map[string]bool) bool

IsBaselined checks both current and legacy baseline key formats.

func LegacyFindingKey

func LegacyFindingKey(f types.Finding) string

LegacyFindingKey returns the pre-1.0.1 baseline key format.

func PrintTable

func PrintTable(w io.Writer, findings []types.Finding, opts PrintOptions)

PrintTable renders findings as a formatted table using tablewriter and emits a summary footer containing counts and optional duration/files scanned.

func PrintText

func PrintText(w io.Writer, findings []types.Finding, opts PrintOptions)

PrintText renders findings as columnar text output and emits a summary footer containing counts and optional duration/files scanned.

func SaveBaseline

func SaveBaseline(path string, findings []types.Finding) error

func ShouldFail

func ShouldFail(findings []types.Finding, failOn string) bool

func WriteSARIF

func WriteSARIF(w io.Writer, findings []types.Finding) error

WriteSARIF writes findings as SARIF 2.1.0 to the provided writer.

func WriteSARIFWithStats

func WriteSARIFWithStats(w io.Writer, findings []types.Finding, artifactStats map[string]int) error

WriteSARIFWithStats writes findings as SARIF and includes artifactStats in the run.properties bag.

Types

type Baseline

type Baseline struct {
	Items map[string]bool `json:"items"`
}

func LoadBaseline

func LoadBaseline(path string) (Baseline, error)

type PrintOptions

type PrintOptions struct {
	NoColor       bool
	Duration      time.Duration
	FilesScanned  int
	TotalFiles    int // Total files that could be scanned
	TotalFindings int // Total findings before baseline filtering
}

PrintOptions controls table rendering and summary stats for PrintTable.

Jump to

Keyboard shortcuts

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