output

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package output formats review results for terminal and machine consumption.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatGitHubReview

func FormatGitHubReview(findings []Finding) string

FormatGitHubReview formats all findings as a single GitHub PR review body.

func FormatJSON

func FormatJSON(findings []Finding) (string, error)

FormatJSON renders findings as machine-readable JSON.

func FormatSARIF

func FormatSARIF(findings []Finding) (string, error)

FormatSARIF produces SARIF 2.1.0 JSON from review findings.

func FormatTerminal

func FormatTerminal(findings []Finding, stats Stats) string

FormatTerminal renders a human-readable review report with ANSI colors.

Types

type Finding

type Finding struct {
	Concern   string
	Severity  int
	File      string
	Line      int
	EndLine   int
	Message   string
	Fix       string
	Reasoning string
	CWE       string
}

Finding for rendering.

type SARIFArtifactChange

type SARIFArtifactChange struct {
	ArtifactLocation SARIFArtifactLocation `json:"artifactLocation"`
	Replacements     []SARIFReplacement    `json:"replacements"`
}

type SARIFArtifactLocation

type SARIFArtifactLocation struct {
	URI string `json:"uri"`
}

type SARIFDriver

type SARIFDriver struct {
	Name           string      `json:"name"`
	Version        string      `json:"version"`
	InformationURI string      `json:"informationUri"`
	Rules          []SARIFRule `json:"rules,omitempty"`
}

type SARIFFix

type SARIFFix struct {
	Description SARIFMultiformat      `json:"description"`
	Changes     []SARIFArtifactChange `json:"artifactChanges"`
}

type SARIFInsertedContent

type SARIFInsertedContent struct {
	Text string `json:"text"`
}

type SARIFLocation

type SARIFLocation struct {
	PhysicalLocation SARIFPhysicalLocation `json:"physicalLocation"`
}

type SARIFLog

type SARIFLog struct {
	Schema  string     `json:"$schema"`
	Version string     `json:"version"`
	Runs    []SARIFRun `json:"runs"`
}

type SARIFMultiformat

type SARIFMultiformat struct {
	Text string `json:"text"`
}

type SARIFPhysicalLocation

type SARIFPhysicalLocation struct {
	ArtifactLocation SARIFArtifactLocation `json:"artifactLocation"`
	Region           *SARIFRegion          `json:"region,omitempty"`
}

type SARIFRegion

type SARIFRegion struct {
	StartLine   int `json:"startLine,omitempty"`
	EndLine     int `json:"endLine,omitempty"`
	StartColumn int `json:"startColumn,omitempty"`
}

type SARIFReplacement

type SARIFReplacement struct {
	DeletedRegion   SARIFRegion           `json:"deletedRegion"`
	InsertedContent *SARIFInsertedContent `json:"insertedContent,omitempty"`
}

type SARIFResult

type SARIFResult struct {
	RuleID    string               `json:"ruleId"`
	Level     string               `json:"level"`
	Message   SARIFMultiformat     `json:"message"`
	Locations []SARIFLocation      `json:"locations,omitempty"`
	Fixes     []SARIFFix           `json:"fixes,omitempty"`
	Taxa      []SARIFTaxaReference `json:"taxa,omitempty"`
}

type SARIFRule

type SARIFRule struct {
	ID               string           `json:"id"`
	Name             string           `json:"name"`
	ShortDescription SARIFMultiformat `json:"shortDescription"`
	DefaultConfig    *SARIFRuleConfig `json:"defaultConfiguration,omitempty"`
}

type SARIFRuleConfig

type SARIFRuleConfig struct {
	Level string `json:"level"`
}

type SARIFRun

type SARIFRun struct {
	Tool    SARIFTool     `json:"tool"`
	Results []SARIFResult `json:"results"`
}

type SARIFTaxaReference

type SARIFTaxaReference struct {
	ID            string           `json:"id"`
	ToolComponent SARIFMultiformat `json:"toolComponent"`
}

SARIFTaxaReference references an external taxonomy entry (e.g., CWE).

type SARIFTool

type SARIFTool struct {
	Driver SARIFDriver `json:"driver"`
}

type Stats

type Stats struct {
	FilesReviewed      int
	HunksAnalyzed      int
	FindingsTotal      int
	BySeverity         map[int]int
	ByConcern          map[string]int
	TokensUsed         int
	DurationPerConcern map[string]time.Duration
}

Stats for rendering.

Jump to

Keyboard shortcuts

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