reporting

package
v1.209.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: Apache-2.0 Imports: 8 Imported by: 12

Documentation

Index

Constants

View Source
const (
	Green = iota + 1
	Yellow
	Red
	Grey
	Black
)

enum for style types

View Source
const StepReportDirectory = ".pipeline/stepReports"

StepReportDirectory specifies the default directory for markdown reports which can later be collected by step pipelineCreateSummary

Variables

This section is empty.

Functions

func UploadMultipleReportsToGithub added in v1.204.0

func UploadMultipleReportsToGithub(scanReports *[]IssueDetail, token, APIURL, owner, repository string, assignees, trustedCerts []string, uploader Uploader) error

UploadMultipleReportsToGithub uploads a number of reports to GitHub, one per IssueDetail to create transparency

func UploadSingleReportToGithub added in v1.198.0

func UploadSingleReportToGithub(scanReport IssueDetail, token, APIURL, owner, repository string, assignees []string, uploader Uploader) error

UploadSingleReportToGithub uploads a single report to GitHub

Types

type ColumnStyle

type ColumnStyle int

ColumnStyle defines style for a specific column

func (ColumnStyle) String

func (c ColumnStyle) String() string

type IssueDetail added in v1.204.0

type IssueDetail interface {
	Title() string
	ToMarkdown() ([]byte, error)
	ToTxt() string
}

IssueDetail represents any content that can be transformed into the body of a GitHub issue

type OverviewRow added in v1.125.0

type OverviewRow struct {
	Description string      `json:"description"`
	Details     string      `json:"details,omitempty"`
	Style       ColumnStyle `json:"style,omitempty"`
}

OverviewRow defines a row in the report's overview section it can consist of a description and some details where the details can have a style attached

type ScanCell

type ScanCell struct {
	Content string      `json:"content"`
	Style   ColumnStyle `json:"style"`
}

ScanCell defines one column of a scan result table

type ScanDetailTable

type ScanDetailTable struct {
	Headers       []string  `json:"headers"`
	Rows          []ScanRow `json:"rows"`
	WithCounter   bool      `json:"withCounter"`
	CounterHeader string    `json:"counterHeader"`
	NoRowsMessage string    `json:"noRowsMessage"`
}

ScanDetailTable defines a table containing scan result details

type ScanReport

type ScanReport struct {
	StepName       string          `json:"stepName"`
	ReportTitle    string          `json:"title"`
	Subheaders     []Subheader     `json:"subheaders"`
	Overview       []OverviewRow   `json:"overview"`
	FurtherInfo    string          `json:"furtherInfo"`
	ReportTime     time.Time       `json:"reportTime"`
	DetailTable    ScanDetailTable `json:"detailTable"`
	SuccessfulScan bool            `json:"successfulScan"`
}

ScanReport defines the elements of a scan report used by various scan steps

func (*ScanReport) AddSubHeader added in v1.125.0

func (s *ScanReport) AddSubHeader(header, details string)

AddSubHeader adds a sub header to the report containing of a text/title plus optional details

func (ScanReport) Title

func (s ScanReport) Title() string

Title returns the title of the report

func (*ScanReport) ToHTML

func (s *ScanReport) ToHTML() ([]byte, error)

ToHTML creates a HTML version of the report

func (*ScanReport) ToJSON added in v1.131.0

func (s *ScanReport) ToJSON() ([]byte, error)

ToJSON returns the report in JSON format

func (ScanReport) ToMarkdown

func (s ScanReport) ToMarkdown() ([]byte, error)

ToMarkdown creates a markdown version of the report content

func (ScanReport) ToTxt added in v1.204.0

func (s ScanReport) ToTxt() string

ToTxt up to now returns the report in JSON format

type ScanRow

type ScanRow struct {
	Columns []ScanCell `json:"columns"`
}

ScanRow defines one row of a scan result table

func (*ScanRow) AddColumn added in v1.125.0

func (s *ScanRow) AddColumn(content interface{}, style ColumnStyle)

AddColumn adds a column to a dedicated ScanRow

type Subheader added in v1.125.0

type Subheader struct {
	Description string `json:"text"`
	Details     string `json:"details,omitempty"`
}

Subheader defines a dedicated sub header in a report

type Uploader added in v1.198.0

type Uploader interface {
	CreateIssue(ghCreateIssueOptions *piperGithub.CreateIssueOptions) error
}

Jump to

Keyboard shortcuts

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