popeye: github.com/derailed/popeye/internal/issues Index | Files

package issues

import "github.com/derailed/popeye/internal/issues"


Package Files

codes.go collector.go issue.go issues.go


const Root = "__root__"

Root denotes a root issue group.


var Blank = Issue{}

Blank issue

func LevelToStr Uses

func LevelToStr(l Level) string

LevelToStr returns a severity level as a string.

type Code Uses

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

Code represents a sanitizer code.

func (*Code) Format Uses

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

Format hydrates a message with arguments.

type Codes Uses

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

Codes represents a collection of sanitizer codes.

func LoadCodes Uses

func LoadCodes() (*Codes, error)

LoadCodes retrieves sanitifizers codes from yaml file.

func (*Codes) Refine Uses

func (c *Codes) Refine(gloss Glossary)

Refine overrides code severity based on user input.

type Collector Uses

type Collector struct {
    // contains filtered or unexported fields

Collector represents a sanitizer issue container.

func NewCollector Uses

func NewCollector(codes *Codes) *Collector

NewCollector returns a new issue collector.

func (*Collector) AddCode Uses

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

AddCode add an error code.

func (*Collector) AddErr Uses

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

AddErr adds a collection of errors.

func (*Collector) AddSubCode Uses

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

AddSubCode add a sub error code.

func (*Collector) InitOutcome Uses

func (c *Collector) InitOutcome(section string)

InitOutcome creates a places holder for potential issues.

func (*Collector) MaxSeverity Uses

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

MaxSeverity return the highest severity level foe the given section.

func (*Collector) NoConcerns Uses

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

NoConcerns returns true is scan is successful.

func (*Collector) Outcome Uses

func (c *Collector) Outcome() Outcome

Outcome returns scan outcome.

type Glossary Uses

type Glossary map[ID]*Code

Glossary represents a collection of codes.

type ID Uses

type ID int

ID represents a sanitizer code indentifier.

type Issue Uses

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 Uses

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

New returns a new lint issue.

func Newf Uses

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

Newf returns a new lint issue using a formatter.

func (Issue) Blank Uses

func (i Issue) Blank() bool

Blank checks if an issue is blank.

func (Issue) IsSubIssue Uses

func (i Issue) IsSubIssue() bool

IsSubIssue checks if error is a sub error.

type Issues Uses

type Issues []Issue

Issues represents a collection of issues.

func (Issues) Group Uses

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

Group collect issues as groups.

func (Issues) MaxSeverity Uses

func (i Issues) MaxSeverity() Level

MaxSeverity gather the max severity in a collection of issues.

type Level Uses

type Level int

Level tracks sanitizer message level.

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

type Outcome Uses

type Outcome map[string]Issues

Outcome represents outcomes resulting from sanitization pass.

func (Outcome) For Uses

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

For returns issues for a given section/group.

func (Outcome) MaxGroupSeverity Uses

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

MaxGroupSeverity scans the issues and reports the highest severity.

func (Outcome) MaxSeverity Uses

func (o Outcome) MaxSeverity(section string) Level

MaxSeverity scans the issues and reports the highest severity.

Package issues imports 3 packages (graph) and is imported by 5 packages. Updated 2019-09-24. Refresh now. Tools for package owners.