report

package
v0.0.0-...-82b092a Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaVersion = 2

	FormatTable      = "table"
	FormatJSON       = "json"
	FormatTemplate   = "template"
	FormatSarif      = "sarif"
	FormatCycloneDX  = "cyclonedx"
	FormatSPDX       = "spdx"
	FormatSPDXJSON   = "spdx-json"
	FormatGitHub     = "github"
	FormatCosignVuln = "cosign-vuln"
)

Variables

View Source
var CustomTemplateFuncMap = map[string]interface{}{}

CustomTemplateFuncMap is used to overwrite existing functions for testing.

View Source
var (
	SupportedSBOMFormats = []string{
		FormatCycloneDX,
		FormatSPDX,
		FormatSPDXJSON,
		FormatGitHub,
	}
)

Functions

func ToPathUri

func ToPathUri(input string) string

func Write

func Write(report types.Report, option Option) error

Write writes the result to output, format as passed in argument

Types

type JSONWriter

type JSONWriter struct {
	Output io.Writer
}

JSONWriter implements result Writer

func (JSONWriter) Write

func (jw JSONWriter) Write(report types.Report) error

Write writes the results in JSON format

type Option

type Option struct {
	AppVersion string

	Format         string
	Report         string
	Output         io.Writer
	Tree           bool
	Severities     []dbTypes.Severity
	OutputTemplate string
	Compliance     spec.ComplianceSpec

	// For misconfigurations
	IncludeNonFailures bool
	Trace              bool

	// For licenses
	LicenseRiskThreshold int
	IgnoredLicenses      []string
}

type SarifWriter

type SarifWriter struct {
	Output  io.Writer
	Version string
	// contains filtered or unexported fields
}

SarifWriter implements result Writer

func (SarifWriter) Write

func (sw SarifWriter) Write(report types.Report) error

type TemplateWriter

type TemplateWriter struct {
	Output   io.Writer
	Template *template.Template
}

TemplateWriter write result in custom format defined by user's template

func NewTemplateWriter

func NewTemplateWriter(output io.Writer, outputTemplate string) (*TemplateWriter, error)

NewTemplateWriter is the factory method to return TemplateWriter object

func (TemplateWriter) Write

func (tw TemplateWriter) Write(report types.Report) error

Write writes result

type Writer

type Writer interface {
	Write(types.Report) error
}

Writer defines the result write operation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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