reporter

package
v0.0.0-...-127562d Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Width the maximum width of the report.
	Width = 100
)

Variables

View Source
	`  ___ ___                __    ___________              `,
	` /   |   \_____ __  _  _|  | __\_   _____/__.__. ____   `,
	`/    ~    \__  \\ \/ \/ /  |/ / |    __)<   |  |/ __ \  `,
	`\    Y    // __ \\     /|    <  |        \___  \  ___/  `,
	` \___|_  /(____  /\/\_/ |__|_ \/_______  / ____|\___  > `,
	`       \/      \/            \/        \/\/         \/  `,
}

HawkEye logo

Functions

func Black

func Black(s string) string

func Blue

func Blue(s string) string

func Colorize

func Colorize(s string, c Color) string

Colorize a string based on given color.

func ColorizeForLevel

func ColorizeForLevel(l conf.Level, s string) string

Colorize a string for level.

func ColorizeForScore

func ColorizeForScore(score int, s string) string

Colorize a string for score.

func Cyan

func Cyan(s string) string

func EmojiForLevel

func EmojiForLevel(l conf.Level) string

EmojiForLevel maps lint level to emoji

func Green

func Green(s string) string

func HiBlack

func HiBlack(s string) string

func HiBlue

func HiBlue(s string) string

func HiCyan

func HiCyan(s string) string

func HiGreen

func HiGreen(s string) string

func HiMagenta

func HiMagenta(s string) string

func HiRed

func HiRed(s string) string

func HiWhite

func HiWhite(s string) string

func HiYellow

func HiYellow(s string) string

func Magenta

func Magenta(s string) string

func Red

func Red(s string) string

func White

func White(s string) string

func Yellow

func Yellow(s string) string

Types

type Color

type Color int

Color defines a single SGR Code

const (
	FgBlack Color = iota + 30
	FgRed
	FgGreen
	FgYellow
	FgBlue
	FgMagenta
	FgCyan
	FgWhite
)

Foreground text colors

const (
	FgHiBlack Color = iota + 90
	FgHiRed
	FgHiGreen
	FgHiYellow
	FgHiBlue
	FgHiMagenta
	FgHiCyan
	FgHiWhite
)

Foreground Hi-Intensity text colors

type Report

type Report struct {
	Score    int      `json:"score" yaml:"score"`
	Grade    string   `json:"grade" yaml:"grade"`
	Sections Sections `json:"sections,omitempty" yaml:"sections,omitempty"`
}

Report represents the output of a sanitization pass.

func NewReport

func NewReport() *Report

NewReport returns a new Report

type ReportWriter

type ReportWriter struct {
	io.Writer
}

ReportWriter report writer.

func NewReportWriter

func NewReportWriter(w io.Writer) *ReportWriter

NewReportWriter returns a new report writer.

func (*ReportWriter) Close

func (r *ReportWriter) Close()

Close a report section.

func (*ReportWriter) Open

func (r *ReportWriter) Open(msg string)

Open begins a new report section.

func (*ReportWriter) Print

func (r *ReportWriter) Print(l conf.Level, indent int, msg string)

Close a report section.

type Reporter

type Reporter struct {
	Report      *Report
	ClusterName string
}

Reporter represents reporter

func NewReporter

func NewReporter() *Reporter

NewReporter returns a new Reporter

func (*Reporter) AddSections

func (r *Reporter) AddSections(s *Section)

AddSections add report section

func (*Reporter) Dump

func (r *Reporter) Dump() error

Dump all reports to output.

func (*Reporter) MergeSections

func (r *Reporter) MergeSections()

MergeSections merge section by group

func (*Reporter) PrintHeader

func (r *Reporter) PrintHeader()

PrintHeader prints report header.

func (*Reporter) PrintSections

func (r *Reporter) PrintSections()

PrintReport prints section (kubernetes resource) report

func (*Reporter) PrintSummary

func (r *Reporter) PrintSummary()

PrintSummary summary report

type Section

type Section struct {
	Title  *registry.Name
	Issues issue.Issues
	Count  int
	Group  string
}

Section represents a report section

func NewSection

func NewSection(title *registry.Name) *Section

type Sections

type Sections []*Section

func NewSections

func NewSections() Sections

func (Sections) Group

func (s Sections) Group() Sections

Group merge sections by group, except ""

Jump to

Keyboard shortcuts

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