reporter

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ErrorLevel is for unexpected problems that require attention.
	ErrorLevel = iota
	// WarnLevel is for indicating potential issues or something that should be brought to the attention of users.
	WarnLevel
	// InfoLevel is for general information about what OSV-Scanner is doing during its runtime.
	InfoLevel
	// VerboseLevel is for providing even more information compared to InfoLevel about the inner workings of OSV-Scanner.
	VerboseLevel
)

Variables

This section is empty.

Functions

func Format added in v1.4.0

func Format() []string

func VerbosityLevels added in v1.6.0

func VerbosityLevels() []string

Types

type CycloneDXReporter added in v1.8.2

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

func NewCycloneDXReporter added in v1.8.2

func NewCycloneDXReporter(stdout, stderr io.Writer, version models.CycloneDXVersion, level VerbosityLevel) *CycloneDXReporter

func (*CycloneDXReporter) Errorf added in v1.8.2

func (r *CycloneDXReporter) Errorf(format string, a ...any)

func (*CycloneDXReporter) HasErrored added in v1.8.2

func (r *CycloneDXReporter) HasErrored() bool

func (*CycloneDXReporter) Infof added in v1.8.2

func (r *CycloneDXReporter) Infof(format string, a ...any)

func (*CycloneDXReporter) PrintResult added in v1.8.2

func (r *CycloneDXReporter) PrintResult(vulnerabilityResults *models.VulnerabilityResults) error

func (*CycloneDXReporter) Verbosef added in v1.8.2

func (r *CycloneDXReporter) Verbosef(format string, a ...any)

func (*CycloneDXReporter) Warnf added in v1.8.2

func (r *CycloneDXReporter) Warnf(format string, a ...any)

type GHAnnotationsReporter added in v1.4.0

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

func NewGHAnnotationsReporter added in v1.4.0

func NewGHAnnotationsReporter(stdout io.Writer, stderr io.Writer, level VerbosityLevel) *GHAnnotationsReporter

func (*GHAnnotationsReporter) Errorf added in v1.6.0

func (r *GHAnnotationsReporter) Errorf(format string, a ...any)

func (*GHAnnotationsReporter) HasErrored added in v1.6.0

func (r *GHAnnotationsReporter) HasErrored() bool

func (*GHAnnotationsReporter) Infof added in v1.6.0

func (r *GHAnnotationsReporter) Infof(format string, a ...any)

func (*GHAnnotationsReporter) PrintResult added in v1.4.0

func (r *GHAnnotationsReporter) PrintResult(vulnResult *models.VulnerabilityResults) error

func (*GHAnnotationsReporter) Verbosef added in v1.6.0

func (r *GHAnnotationsReporter) Verbosef(format string, a ...any)

func (*GHAnnotationsReporter) Warnf added in v1.6.0

func (r *GHAnnotationsReporter) Warnf(format string, a ...any)

type HTMLReporter added in v1.9.1

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

func NewHTMLReporter added in v1.9.1

func NewHTMLReporter(stdout io.Writer, stderr io.Writer, level VerbosityLevel) *HTMLReporter

func (*HTMLReporter) Errorf added in v1.9.1

func (r *HTMLReporter) Errorf(format string, a ...any)

func (*HTMLReporter) HasErrored added in v1.9.1

func (r *HTMLReporter) HasErrored() bool

func (*HTMLReporter) Infof added in v1.9.1

func (r *HTMLReporter) Infof(format string, a ...any)

func (*HTMLReporter) PrintResult added in v1.9.1

func (r *HTMLReporter) PrintResult(vulnResult *models.VulnerabilityResults) error

func (*HTMLReporter) Verbosef added in v1.9.1

func (r *HTMLReporter) Verbosef(format string, a ...any)

func (*HTMLReporter) Warnf added in v1.9.1

func (r *HTMLReporter) Warnf(format string, a ...any)

type JSONReporter

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

JSONReporter prints vulnerability results in JSON format to stdout. Runtime information will be written to stderr.

func NewJSONReporter

func NewJSONReporter(stdout io.Writer, stderr io.Writer, level VerbosityLevel) *JSONReporter

func (*JSONReporter) Errorf added in v1.6.0

func (r *JSONReporter) Errorf(format string, a ...any)

func (*JSONReporter) HasErrored added in v1.6.0

func (r *JSONReporter) HasErrored() bool

func (*JSONReporter) Infof added in v1.6.0

func (r *JSONReporter) Infof(format string, a ...any)

func (*JSONReporter) PrintResult

func (r *JSONReporter) PrintResult(vulnResult *models.VulnerabilityResults) error

func (*JSONReporter) Verbosef added in v1.6.0

func (r *JSONReporter) Verbosef(format string, a ...any)

func (*JSONReporter) Warnf added in v1.6.0

func (r *JSONReporter) Warnf(format string, a ...any)

type Reporter

type Reporter interface {
	// Errorf prints errors in an appropriate manner to ensure that results
	// are printed in a way that is semantically valid for the intended consumer,
	// and tracking that an error has been printed.
	//
	// Where the error is actually printed (if at all) is entirely up to the actual
	// reporter, though generally it will be to stderr.
	Errorf(format string, a ...any)
	// HasErrored returns true if there have been any calls to Errorf.
	//
	// This does not actually represent if the error was actually printed anywhere
	// since what happens to the error message is up to the actual reporter.
	HasErrored() bool
	// Warnf prints text indicating potential issues or something that should be brought to the attention of users.
	Warnf(format string, a ...any)
	// Infof prints text providing general information about what OSV-Scanner is doing during its runtime.
	Infof(format string, a ...any)
	// Verbosef prints text providing additional information about the inner workings of OSV-Scanner to the user.
	Verbosef(format string, a ...any)
	// PrintResult prints the models.VulnerabilityResults per the logic of the
	// actual reporter
	PrintResult(vulnResult *models.VulnerabilityResults) error
}

Reporter provides printing operations for vulnerability results and for runtime information (depending on the verbosity level given to the Reporter implementation).

When printing non-error-related runtime information, it is entirely up to the Reporter implementation as to where the text is actually printed (if at all); in most cases for "human format" reporters this will be stdout whereas for "machine format" reporters this will be stderr.

func New added in v1.4.0

func New(format string, stdout, stderr io.Writer, level VerbosityLevel, terminalWidth int) (Reporter, error)

New returns an implementation of the reporter interface depending on the format passed in set terminalWidth as 0 to indicate the output is not a terminal

type SARIFReporter added in v1.4.0

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

func NewSarifReporter added in v1.4.0

func NewSarifReporter(stdout io.Writer, stderr io.Writer, level VerbosityLevel) *SARIFReporter

func (*SARIFReporter) Errorf added in v1.6.0

func (r *SARIFReporter) Errorf(format string, a ...any)

func (*SARIFReporter) HasErrored added in v1.6.0

func (r *SARIFReporter) HasErrored() bool

func (*SARIFReporter) Infof added in v1.6.0

func (r *SARIFReporter) Infof(format string, a ...any)

func (*SARIFReporter) PrintResult added in v1.4.0

func (r *SARIFReporter) PrintResult(vulnResult *models.VulnerabilityResults) error

func (*SARIFReporter) Verbosef added in v1.6.0

func (r *SARIFReporter) Verbosef(format string, a ...any)

func (*SARIFReporter) Warnf added in v1.6.0

func (r *SARIFReporter) Warnf(format string, a ...any)

type TableReporter

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

func NewTableReporter

func NewTableReporter(stdout io.Writer, stderr io.Writer, level VerbosityLevel, markdown bool, terminalWidth int) *TableReporter

func (*TableReporter) Errorf added in v1.6.0

func (r *TableReporter) Errorf(format string, a ...any)

func (*TableReporter) HasErrored added in v1.6.0

func (r *TableReporter) HasErrored() bool

func (*TableReporter) Infof added in v1.6.0

func (r *TableReporter) Infof(format string, a ...any)

func (*TableReporter) PrintResult

func (r *TableReporter) PrintResult(vulnResult *models.VulnerabilityResults) error

func (*TableReporter) Verbosef added in v1.6.0

func (r *TableReporter) Verbosef(format string, a ...any)

func (*TableReporter) Warnf added in v1.6.0

func (r *TableReporter) Warnf(format string, a ...any)

type VerbosityLevel added in v1.6.0

type VerbosityLevel uint8

VerbosityLevel is used to determine what amount of information should be given in OSV-Scanner's runtime.

func ParseVerbosityLevel added in v1.6.0

func ParseVerbosityLevel(text string) (VerbosityLevel, error)

type VerticalReporter added in v1.8.3

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

func NewVerticalReporter added in v1.8.3

func NewVerticalReporter(stdout io.Writer, stderr io.Writer, level VerbosityLevel, markdown bool, terminalWidth int) *VerticalReporter

func (*VerticalReporter) Errorf added in v1.8.3

func (r *VerticalReporter) Errorf(format string, a ...any)

func (*VerticalReporter) HasErrored added in v1.8.3

func (r *VerticalReporter) HasErrored() bool

func (*VerticalReporter) Infof added in v1.8.3

func (r *VerticalReporter) Infof(format string, a ...any)

func (*VerticalReporter) PrintResult added in v1.8.3

func (r *VerticalReporter) PrintResult(vulnResult *models.VulnerabilityResults) error

func (*VerticalReporter) Verbosef added in v1.8.3

func (r *VerticalReporter) Verbosef(format string, a ...any)

func (*VerticalReporter) Warnf added in v1.8.3

func (r *VerticalReporter) Warnf(format string, a ...any)

type VoidReporter

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

func (*VoidReporter) Errorf added in v1.6.0

func (r *VoidReporter) Errorf(_ string, _ ...any)

func (*VoidReporter) HasErrored added in v1.6.0

func (r *VoidReporter) HasErrored() bool

func (*VoidReporter) Infof added in v1.6.0

func (r *VoidReporter) Infof(_ string, _ ...any)

func (*VoidReporter) PrintResult

func (r *VoidReporter) PrintResult(_ *models.VulnerabilityResults) error

func (*VoidReporter) Verbosef added in v1.6.0

func (r *VoidReporter) Verbosef(_ string, _ ...any)

func (*VoidReporter) Warnf added in v1.6.0

func (r *VoidReporter) Warnf(_ string, _ ...any)

Jump to

Keyboard shortcuts

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