Documentation
¶
Index ¶
- Constants
- Variables
- func Colorize(s string, c Color) string
- func Colorizef(c Color, fmat string, args ...interface{}) string
- func EmojiForLevel(l config.Level, jurassic bool) string
- func Grade(score int) string
- func Titleize(res string, count int) string
- type Builder
- func (b *Builder) AddError(err error)
- func (b *Builder) AddSection(gvr client.GVR, singular string, o issues.Outcome, t *Tally)
- func (b *Builder) ClusterName() string
- func (b *Builder) HasContent() bool
- func (b *Builder) PrintClusterInfo(s *Sanitizer, clusterName string, metrics bool)
- func (b *Builder) PrintHeader(s *Sanitizer)
- func (b *Builder) PrintReport(level config.Level, s *Sanitizer)
- func (b *Builder) PrintSummary(s *Sanitizer)
- func (b *Builder) SetClusterName(s string)
- func (b *Builder) ToHTML() (string, error)
- func (b *Builder) ToJSON() (string, error)
- func (b *Builder) ToJunit(level config.Level) (string, error)
- func (b *Builder) ToPrometheus(address *string, namespace string) *push.Pusher
- func (b *Builder) ToScore() (int, error)
- func (b *Builder) ToYAML() (string, error)
- type Color
- type DeltaScore
- type Error
- type Failure
- type Issue
- type Property
- type Report
- type Sanitizer
- func (s *Sanitizer) Badge(score int) []string
- func (s *Sanitizer) Close()
- func (s *Sanitizer) Color(msg string, c Color) string
- func (s *Sanitizer) Comment(msg string)
- func (s *Sanitizer) Dump(l config.Level, ii issues.Issues)
- func (s *Sanitizer) Error(msg string, err error)
- func (s *Sanitizer) Open(msg string, t *Tally)
- func (s *Sanitizer) Print(l config.Level, indent int, msg string)
- type Section
- type Sections
- type Tally
- func (t *Tally) Dump(s *Sanitizer) string
- func (t *Tally) ErrCount() int
- func (t *Tally) IsValid() bool
- func (t *Tally) MarshalJSON() ([]byte, error)
- func (t *Tally) MarshalYAML() (interface{}, error)
- func (t *Tally) Rollup(o issues.Outcome) *Tally
- func (t *Tally) Score() int
- func (t *Tally) UnmarshalYAML(f func(interface{}) error) error
- func (t *Tally) WarnCount() int
- type TestCase
- type TestSuite
- type TestSuites
Constants ¶
const ( // DefaultFormat dumps sanitizer with color, emojis, the works. DefaultFormat = "standard" // JurassicFormat dumps sanitizer with 0 fancyness. JurassicFormat = "jurassic" // YAMLFormat dumps sanitizer as YAML. YAMLFormat = "yaml" // JSONFormat dumps sanitizer as JSON. JSONFormat = "json" // HTMLFormat dumps sanitizer as HTML HTMLFormat = "html" // JunitFormat dumps sanitizer as JUnit report. JunitFormat = "junit" // PrometheusFormat pushes sanitizer as Prometheus metrics. PrometheusFormat = "prometheus" // ScoreFormat pushes sanitizer as the value of the Score. ScoreFormat = "score" )
const ( // FontBold style FontBold = 1 // Width denotes the maximum width of the sanitizer report. Width = 100 )
Variables ¶
var GraderLogo = []string{
"o .-'-. ",
" o __| K `\\ ",
" o `-,-`--._ `\\",
" [] .->' a `|-'",
" `=/ (__/_ / ",
" \\_, ` _) ",
" `----; | ",
}
GraderLogo affords for replacing logo parts.
var Logo = []string{
"K .-'-. ",
" 8 __| `\\ ",
" s `-,-`--._ `\\",
" [] .->' a `|-'",
" `=/ (__/_ / ",
" \\_, ` _) ",
" `----; | ",
}
Logo popeye
var Popeye = []string{
` ___ ___ _____ _____ `,
`| _ \___| _ \ __\ \ / / __|`,
`| _/ _ \ _/ _| \ V /| _| `,
`|_| \___/_| |___| |_| |___|`,
}
Popeye title
Functions ¶
func EmojiForLevel ¶
EmojiForLevel maps lint levels to emojis.
Types ¶
type Builder ¶ added in v0.3.0
type Builder struct {
Report Report `json:"popeye" yaml:"popeye"`
// contains filtered or unexported fields
}
Builder represents sanitizer
func (*Builder) AddSection ¶ added in v0.3.0
AddSection adds a sanitizer section to the report.
func (*Builder) ClusterName ¶ added in v0.7.0
ClusterName returns the cluster name.
func (*Builder) HasContent ¶ added in v0.4.0
HasContent checks if we actually have anything to report.
func (*Builder) PrintClusterInfo ¶ added in v0.3.6
PrintClusterInfo displays cluster information.
func (*Builder) PrintHeader ¶ added in v0.3.0
PrintHeader prints report header to screen.
func (*Builder) PrintReport ¶ added in v0.3.0
PrintReport prints out sanitizer report to screen
func (*Builder) PrintSummary ¶ added in v0.3.0
PrintSummary print outs summary report to screen.
func (*Builder) SetClusterName ¶ added in v0.7.0
SetClusterName sets the current cluster name.
func (*Builder) ToPrometheus ¶ added in v0.5.0
ToPrometheus returns prometheus pusher.
type Color ¶
type Color int
Color tracks the output color.
const ( ColorWhite Color = 15 ColorLighSlate Color = 75 ColorGreen Color = 82 ColorCoolBlue Color = 99 ColorBlue Color = 105 ColorGreenPale Color = 114 ColorAqua Color = 122 ColorDarkOlive Color = 155 ColorYellow2 Color = 190 ColorRed Color = 196 ColorOrangRed Color = 202 ColorOrange Color = 208 ColorOrangish Color = 220 ColorYellow Color = 226 ColorGray Color = 250 )
Color ANSI palette (256!)
type DeltaScore ¶ added in v0.4.0
type DeltaScore struct {
// contains filtered or unexported fields
}
DeltaScore tracks delta between 2 tally scores.
func NewDeltaScore ¶ added in v0.4.0
func NewDeltaScore(level config.Level, s1, s2 int, inverse bool) DeltaScore
NewDeltaScore returns a new delta score.
type Error ¶
type Error struct {
XMLName xml.Name `xml:"error"`
Message string `xml:"message,attr"`
Type string `xml:"type,attr"`
}
Error represents a test error..
type Failure ¶ added in v0.4.0
type Failure struct {
XMLName xml.Name `xml:"failure"`
Message string `xml:"message,attr"`
Type string `xml:"type,attr"`
}
Failure represents a test failure.
type Issue ¶ added in v0.3.4
type Issue interface {
MaxSeverity(string) config.Level
Severity() config.Level
Description() string
HasSubIssues() bool
SubIssues() map[string][]Issue
}
Issue represents a sanitizer issues.
type Report ¶ added in v0.3.0
type Report struct {
Score int `json:"score" yaml:"score"`
Grade string `json:"grade" yaml:"grade"`
Sections Sections `json:"sanitizers,omitempty" yaml:"sanitizers,omitempty"`
Errors []error `json:"errors,omitempty" yaml:"errors,omitempty"`
// contains filtered or unexported fields
}
Report represents the output of a sanitization pass.
type Sanitizer ¶ added in v0.2.0
Sanitizer represents a sanitizer report.
func NewSanitizer ¶ added in v0.2.0
NewSanitizer returns a new sanitizer report writer.
type Section ¶ added in v0.3.0
type Section struct {
Title string `json:"sanitizer" yaml:"sanitizer"`
GVR string `json:"gvr" yaml:"gvr"`
Tally *Tally `json:"tally" yaml:"tally"`
Outcome issues.Outcome `json:"issues,omitempty" yaml:"issues,omitempty"`
// contains filtered or unexported fields
}
Section represents a sanitizer pass
type Sections ¶ added in v0.8.0
type Sections []Section
Sections represents a collection of sections.
type Tally ¶
type Tally struct {
// contains filtered or unexported fields
}
Tally tracks lint section scores.
func (*Tally) MarshalJSON ¶ added in v0.3.0
MarshalJSON renders a tally to JSON.
func (*Tally) MarshalYAML ¶ added in v0.3.0
MarshalYAML renders a tally to YAML.
func (*Tally) UnmarshalYAML ¶ added in v0.4.0
UnmarshalYAML renders a tally to YAML.
type TestCase ¶ added in v0.4.0
type TestCase struct {
XMLName xml.Name `xml:"testcase"`
Classname string `xml:"classname,attr"`
Name string `xml:"name,attr"`
Failures []Failure
Errors []Error
}
TestCase represents a sing junit test.
type TestSuite ¶ added in v0.4.0
type TestSuite struct {
XMLName xml.Name `xml:"testsuite"`
Name string `xml:"name,attr"`
Tests int `xml:"tests,attr"`
Failures int `xml:"failures,attr"`
Errors int `xml:"errors,attr"`
Properties []Property `xml:"properties>property,omitempty"`
TestCases []TestCase
}
TestSuite represents a collection of tests