output

package
v3.97.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: AGPL-3.0 Imports: 27 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BranchHeads

func BranchHeads(repo *gogit.Repository) (map[string]*object.Commit, error)

BranchHeads creates a map of branch names to their head commit. This can be used to find if a commit is an ancestor of a branch head.

func FindBranch

func FindBranch(commit *object.Commit, repo *gogit.Repository) string

FindBranch returns the first branch a commit is a part of. Not the most accurate, but it should work similar to pre v3.0.

func GenerateDiff

func GenerateDiff(commit *object.Commit, fileName string) string

GenerateDiff will take a commit and create a string diff between the commit and its first parent.

Types

type GitHubActionsPrinter added in v3.46.0

type GitHubActionsPrinter struct {
	// contains filtered or unexported fields
}

GitHubActionsPrinter is a printer that prints results in GitHub Actions format.

func (*GitHubActionsPrinter) Print added in v3.46.0

type JSONPrinter added in v3.46.0

type JSONPrinter struct {
	// contains filtered or unexported fields
}

JSONPrinter is a printer that prints results in JSON format.

func (*JSONPrinter) Print added in v3.46.0

type LegacyJSONCompatibleSource

type LegacyJSONCompatibleSource interface {
	GetCommit() string
	GetFile() string
}

type LegacyJSONOutput

type LegacyJSONOutput struct {
	Branch       string   `json:"branch"`
	Commit       string   `json:"commit"`
	CommitHash   string   `json:"commitHash"`
	Date         string   `json:"date"`
	Diff         string   `json:"diff"`
	Path         string   `json:"path"`
	PrintDiff    string   `json:"printDiff"`
	Reason       string   `json:"reason"`
	StringsFound []string `json:"stringsFound"`
}

type LegacyJSONPrinter added in v3.46.0

type LegacyJSONPrinter struct {
	// contains filtered or unexported fields
}

LegacyJSONPrinter is a printer that prints results in legacy JSON format for backwards compatibility.

func (*LegacyJSONPrinter) Print added in v3.46.0

type PlainPrinter added in v3.46.0

type PlainPrinter struct {
	// contains filtered or unexported fields
}

PlainPrinter is a printer that prints results in plain text format.

func (*PlainPrinter) Print added in v3.46.0

type SarifPrinter added in v3.97.0

type SarifPrinter struct {
	// contains filtered or unexported fields
}

SarifPrinter is a printer that accumulates results and, once the scan completes, emits them as a single SARIF 2.1.0 log. Unlike the other Printer implementations, SARIF results cannot be streamed one-per-line: the spec requires one JSON document containing every run and result, so Print only buffers results and Flush performs the actual marshal/write.

TODO: results are held in memory for the full scan and Flush marshals them in one pass, so peak memory grows with result count (roughly 2x at Flush, for the struct plus its marshaled JSON). Fine for typical scan sizes; if scans with very large result counts start OOMing, switch to writing results to the underlying writer incrementally as they're produced in Print.

func (*SarifPrinter) Flush added in v3.97.0

func (p *SarifPrinter) Flush(w io.Writer) error

Flush marshals every result buffered by Print into a single SARIF 2.1.0 log and writes it to w. It must be called exactly once, after all Print calls have completed (i.e. once the scan has finished), since SARIF is a single JSON document rather than a streamable format.

func (*SarifPrinter) Print added in v3.97.0

Print buffers a single result for inclusion in the SARIF document written by Flush.

Jump to

Keyboard shortcuts

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