reporter

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DriverInfoURI = "https://github.com/Boeing/config-file-validator"
View Source
const DriverName = "config-file-validator"
View Source
const DriverVersion = "1.8.0"
View Source
const (
	Header = `<?xml version="1.0" encoding="UTF-8"?>` + "\n"
)
View Source
const SARIFSchema = "https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json"
View Source
const SARIFVersion = "2.1.0"

Variables

This section is empty.

Functions

func PrintDoubleGroupJSON

func PrintDoubleGroupJSON(groupReports map[string]map[string][]Report) error

Prints the report for when two groups are passed in the groupby flag

func PrintDoubleGroupStdout

func PrintDoubleGroupStdout(groupReport map[string]map[string][]Report) error

Prints the report for when two groups are passed in the groupby flag

func PrintSingleGroupJSON

func PrintSingleGroupJSON(groupReports map[string][]Report) error

Prints the report for when one group is passed in the groupby flag

func PrintSingleGroupStdout

func PrintSingleGroupStdout(groupReport map[string][]Report) error

There is repeated code in the following two functions. Trying to consolidate the code into one function is difficult because of the output format

func PrintTripleGroupJSON

func PrintTripleGroupJSON(groupReports map[string]map[string]map[string][]Report) error

Prints the report for when three groups are passed in the groupby flag

func PrintTripleGroupStdout

func PrintTripleGroupStdout(groupReport map[string]map[string]map[string][]Report) error

Prints the report for when three groups are passed in the groupby flag

Types

type JSONReporter

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

func NewJSONReporter

func NewJSONReporter(outputDest string) *JSONReporter

func (JSONReporter) Print

func (jr JSONReporter) Print(reports []Report) error

Print implements the Reporter interface by outputting the report content to stdout as JSON if outputDest flag is provided, output results to a file.

type JunitReporter

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

func NewJunitReporter

func NewJunitReporter(outputDest string) *JunitReporter

func (JunitReporter) Print

func (jr JunitReporter) Print(reports []Report) error

type Message

type Message struct {
	InnerXML string `xml:",innerxml"`
}

type Property

type Property struct {
	XMLName   xml.Name `xml:"property"`
	TextValue string   `xml:",chardata"`
	Name      string   `xml:"name,attr"`
	Value     string   `xml:"value,attr,omitempty"`
}

type Report

type Report struct {
	FileName         string
	FilePath         string
	IsValid          bool
	ValidationError  error
	ValidationErrors []string
	ErrorType        string
	IsQuiet          bool
	StartLine        int
	StartColumn      int
}

The Report object stores information about the report and the results of the validation

type Reporter

type Reporter interface {
	Print(reports []Report) error
}

Print accepts an array of Report objects and determines how to output the contents. Output could be stdout, files, etc

type SARIFLog

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

type SARIFReporter

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

func NewSARIFReporter

func NewSARIFReporter(outputDest string) *SARIFReporter

func (SARIFReporter) Print

func (sr SARIFReporter) Print(reports []Report) error

type Skipped

type Skipped struct {
	XMLName xml.Name `xml:"skipped"`
	Message string   `xml:"message,attr"`
}

type StdoutReporter

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

func NewStdoutReporter

func NewStdoutReporter(outputDest string) *StdoutReporter

func (StdoutReporter) Print

func (sr StdoutReporter) Print(reports []Report) error

Print implements the Reporter interface by outputting the report content to stdout

type SystemErr

type SystemErr struct {
	XMLName   xml.Name `xml:"system-err"`
	TextValue string   `xml:",chardata"`
}

type SystemOut

type SystemOut struct {
	XMLName   xml.Name `xml:"system-out"`
	TextValue string   `xml:",chardata"`
}

type Testcase

type Testcase struct {
	XMLName         xml.Name         `xml:"testcase"`
	Name            string           `xml:"name,attr"`
	ClassName       string           `xml:"classname,attr"`
	Assertions      int              `xml:"assertions,attr,omitempty"`
	Time            float32          `xml:"time,attr,omitempty"`
	File            string           `xml:"file,attr,omitempty"`
	Line            int              `xml:"line,attr,omitempty"`
	Skipped         *Skipped         `xml:"skipped,attr,omitempty"`
	Properties      *[]Property      `xml:"properties>property,omitempty"`
	TestcaseError   *TestcaseError   `xml:"error,omitempty"`
	TestcaseFailure *TestcaseFailure `xml:"failure,omitempty"`
}

type TestcaseError

type TestcaseError struct {
	XMLName   xml.Name `xml:"error"`
	Message   Message
	Type      string `xml:"type,omitempty"`
	TextValue string `xml:",chardata"`
}

type TestcaseFailure

type TestcaseFailure struct {
	XMLName xml.Name `xml:"failure"`
	// Message   string   `xml:"message,omitempty"`
	Message   Message
	Type      string `xml:"type,omitempty"`
	TextValue string `xml:",chardata"`
}

type Testsuite

type Testsuite struct {
	XMLName    xml.Name    `xml:"testsuite"`
	Name       string      `xml:"name,attr"`
	Tests      int         `xml:"tests,attr,omitempty"`
	Failures   int         `xml:"failures,attr,omitempty"`
	Errors     int         `xml:"errors,attr,omitempty"`
	Skipped    int         `xml:"skipped,attr,omitempty"`
	Assertions int         `xml:"assertions,attr,omitempty"`
	Time       float32     `xml:"time,attr,omitempty"`
	Timestamp  *time.Time  `xml:"timestamp,attr,omitempty"`
	File       string      `xml:"file,attr,omitempty"`
	Testcases  *[]Testcase `xml:"testcase,omitempty"`
	Properties *[]Property `xml:"properties>property,omitempty"`
	SystemOut  *SystemOut  `xml:"system-out,omitempty"`
	SystemErr  *SystemErr  `xml:"system-err,omitempty"`
}

type Testsuites

type Testsuites struct {
	XMLName    xml.Name    `xml:"testsuites"`
	Name       string      `xml:"name,attr,omitempty"`
	Tests      int         `xml:"tests,attr,omitempty"`
	Failures   int         `xml:"failures,attr,omitempty"`
	Errors     int         `xml:"errors,attr,omitempty"`
	Skipped    int         `xml:"skipped,attr,omitempty"`
	Assertions int         `xml:"assertions,attr,omitempty"`
	Time       float32     `xml:"time,attr,omitempty"`
	Timestamp  *time.Time  `xml:"timestamp,attr,omitempty"`
	Testsuites []Testsuite `xml:"testsuite"`
}

https://github.com/testmoapp/junitxml#basic-junit-xml-structure

Jump to

Keyboard shortcuts

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