issues

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const Root = "__root__"

Root denotes a root issue group.

Variables

View Source
var Blank = Issue{}

Blank issue

Functions

func LevelToStr added in v0.4.0

func LevelToStr(l Level) string

LevelToStr returns a severity level as a string.

Types

type Code added in v0.4.0

type Code struct {
	Message  string `yaml:"message"`
	Severity Level  `yaml:"severity"`
}

Code represents a sanitizer code.

func (*Code) Format added in v0.4.0

func (c *Code) Format(code ID, args ...interface{}) string

Format hydrates a message with arguments.

type Codes added in v0.4.0

type Codes struct {
	Glossary Glossary `yaml:"codes"`
}

Codes represents a collection of sanitizer codes.

func LoadCodes added in v0.4.0

func LoadCodes() (*Codes, error)

LoadCodes retrieves sanitifizers codes from yaml file.

func (*Codes) Refine added in v0.4.0

func (c *Codes) Refine(gloss Glossary)

Refine overrides code severity based on user input.

type Collector

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

Collector represents a sanitizer issue container.

func NewCollector

func NewCollector(codes *Codes) *Collector

NewCollector returns a new issue collector.

func (*Collector) AddCode added in v0.4.0

func (c *Collector) AddCode(code ID, section string, args ...interface{})

AddCode add an error code.

func (*Collector) AddErr

func (c *Collector) AddErr(res string, errs ...error)

AddErr adds a collection of errors.

func (*Collector) AddSubCode added in v0.4.0

func (c *Collector) AddSubCode(code ID, section, group string, args ...interface{})

AddSubCode add a sub error code.

func (*Collector) InitOutcome

func (c *Collector) InitOutcome(section string)

InitOutcome creates a places holder for potential issues.

func (*Collector) MaxSeverity

func (c *Collector) MaxSeverity(section string) Level

MaxSeverity return the highest severity level foe the given section.

func (*Collector) NoConcerns

func (c *Collector) NoConcerns(section string) bool

NoConcerns returns true is scan is successful.

func (*Collector) Outcome

func (c *Collector) Outcome() Outcome

Outcome returns scan outcome.

type Glossary added in v0.4.0

type Glossary map[ID]*Code

Glossary represents a collection of codes.

type ID added in v0.4.0

type ID int

ID represents a sanitizer code indentifier.

type Issue

type Issue struct {
	Group   string `yaml:"group" json:"group"`
	Level   Level  `yaml:"level" json:"level"`
	Message string `yaml:"message" json:"message"`
}

Issue tracks a sanitizer issui.

func New

func New(group string, level Level, description string) Issue

New returns a new lint issue.

func Newf

func Newf(group string, level Level, format string, args ...interface{}) Issue

Newf returns a new lint issue using a formatter.

func (Issue) Blank

func (i Issue) Blank() bool

Blank checks if an issue is blank.

func (Issue) IsSubIssue

func (i Issue) IsSubIssue() bool

IsSubIssue checks if error is a sub error.

type Issues

type Issues []Issue

Issues represents a collection of issues.

func (Issues) Group

func (i Issues) Group() map[string]Issues

Group collect issues as groups.

func (Issues) MaxSeverity

func (i Issues) MaxSeverity() Level

MaxSeverity gather the max severity in a collection of issues.

type Level

type Level int

Level tracks sanitizer message level.

const (
	// OkLevel denotes no sanitizing issues.
	OkLevel Level = iota
	// InfoLevel denotes and FYI issues.
	InfoLevel
	// WarnLevel denotes a warning issui.
	WarnLevel
	// ErrorLevel denotes a serious issui.
	ErrorLevel
)

type Outcome

type Outcome map[string]Issues

Outcome represents outcomes resulting from sanitization pass.

func (Outcome) For

func (o Outcome) For(section, group string) Issues

For returns issues for a given section/group.

func (Outcome) MaxGroupSeverity

func (o Outcome) MaxGroupSeverity(section, group string) Level

MaxGroupSeverity scans the issues and reports the highest severity.

func (Outcome) MaxSeverity

func (o Outcome) MaxSeverity(section string) Level

MaxSeverity scans the issues and reports the highest severity.

Jump to

Keyboard shortcuts

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