reporter

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Form

func Form(count int, singular, plural string) string

Types

type PackageDetailsWithVulnerabilities

type PackageDetailsWithVulnerabilities struct {
	internal.PackageDetails

	Vulnerabilities database.Vulnerabilities `json:"vulnerabilities"`
	Ignored         database.Vulnerabilities `json:"ignored"`
}

type Report

type Report struct {
	lockfile.Lockfile
	// Packages is a map of packages and any vulnerabilities that they're affected by
	Packages []PackageDetailsWithVulnerabilities `json:"packages"`
}

func (Report) HasIgnoredVulnerabilities

func (r Report) HasIgnoredVulnerabilities() bool

func (Report) HasKnownVulnerabilities

func (r Report) HasKnownVulnerabilities() bool

func (Report) String

func (r Report) String() string

type Reporter

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

func New

func New(stdout io.Writer, stderr io.Writer, outputAsJSON bool) *Reporter

func (*Reporter) PrintDatabaseLoadErr

func (r *Reporter) PrintDatabaseLoadErr(err error)

func (*Reporter) PrintError

func (r *Reporter) PrintError(msg string)

PrintError writes the given message to stderr, regardless of if the reporter is outputting as JSON or not

func (*Reporter) PrintJSONResults

func (r *Reporter) PrintJSONResults()

PrintJSONResults prints any results that this reporter has collected to stdout as JSON.

func (*Reporter) PrintKnownEcosystems

func (r *Reporter) PrintKnownEcosystems()

func (*Reporter) PrintResult

func (r *Reporter) PrintResult(result Result)

func (*Reporter) PrintText

func (r *Reporter) PrintText(msg string)

PrintText writes the given message to stdout, _unless_ the reporter is set to output as JSON, in which case it writes the message to stderr.

This should be used for content that should always be outputted, but that should not be captured when piping if outputting JSON.

type Result

type Result interface {
	String() string
}

Jump to

Keyboard shortcuts

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