Documentation
¶
Index ¶
- Constants
- Variables
- func LevelToStr(l rules.Level) string
- func SortKeys(k1, k2 string) int
- type Codes
- type Collector
- func (c *Collector) AddCode(ctx context.Context, code rules.ID, args ...interface{})
- func (c *Collector) AddErr(ctx context.Context, errs ...error)
- func (c *Collector) AddSubCode(ctx context.Context, code rules.ID, args ...interface{})
- func (c *Collector) ClearOutcome(fqn string)
- func (c *Collector) CloseOutcome(ctx context.Context, fqn string, cos []string)
- func (c *Collector) InitOutcome(fqn string)
- func (c *Collector) MaxSeverity(fqn string) rules.Level
- func (c *Collector) NoConcerns(fqn string) bool
- func (c *Collector) Outcome() Outcome
- type Issue
- type Issues
- type Outcome
- func (o Outcome) Dump()
- func (o Outcome) Filter(level rules.Level) Outcome
- func (o Outcome) For(section, group string) Issues
- func (o Outcome) HasIssues() bool
- func (o Outcome) MarshalJSON() ([]byte, error)
- func (o Outcome) MarshalYAML() (interface{}, error)
- func (o Outcome) MaxGroupSeverity(section, group string) rules.Level
- func (o Outcome) MaxSeverity(section string) rules.Level
- func (o Outcome) NSTally() tally.Namespace
Constants ¶
const Root = "__root__"
Root denotes a root issue group.
Variables ¶
var Blank = Issue{}
Blank issue
Functions ¶
func LevelToStr ¶ added in v0.4.0
func LevelToStr(l rules.Level) string
LevelToStr returns a severity level as a string.
Types ¶
type Codes ¶ added in v0.4.0
type Codes struct {
Glossary rules.Glossary `yaml:"codes"`
}
Codes represents a collection of linter codes.
type Collector ¶
type Collector struct {
*config.Config
// contains filtered or unexported fields
}
Collector tracks linter issues and codes.
func NewCollector ¶
func NewCollector(codes *Codes, cfg *config.Config) *Collector
NewCollector returns a new issue collector.
func (*Collector) AddCode ¶ added in v0.4.0
func (c *Collector) AddCode(ctx context.Context, code rules.ID, args ...interface{})
AddCode add an error code.
func (*Collector) AddErr ¶
func (c *Collector) AddErr(ctx context.Context, errs ...error)
AddErr adds a collection of errors.
func (*Collector) AddSubCode ¶ added in v0.4.0
func (c *Collector) AddSubCode(ctx context.Context, code rules.ID, args ...interface{})
AddSubCode add a sub error code.
func (*Collector) ClearOutcome ¶ added in v0.6.0
func (c *Collector) ClearOutcome(fqn string)
ClearOutcome delete all fqn related issues.
func (*Collector) CloseOutcome ¶ added in v0.20.0
func (c *Collector) CloseOutcome(ctx context.Context, fqn string, cos []string)
func (*Collector) InitOutcome ¶
func (c *Collector) InitOutcome(fqn string)
InitOutcome creates a places holder for potential issues.
func (*Collector) MaxSeverity ¶
func (c *Collector) MaxSeverity(fqn string) rules.Level
MaxSeverity return the highest severity level for the given section.
func (*Collector) NoConcerns ¶
func (c *Collector) NoConcerns(fqn string) bool
NoConcerns returns true if scan is successful.
type Issue ¶
type Issue struct {
Group string `yaml:"group" json:"group"`
GVR string `yaml:"gvr" json:"gvr"`
Level rules.Level `yaml:"level" json:"level"`
Message string `yaml:"message" json:"message"`
}
Issue tracks a linter issue.
func New ¶
func New(gvr types.GVR, group string, level rules.Level, description string) Issue
New returns a new lint issue.
func Newf ¶
func Newf(gvr types.GVR, group string, level rules.Level, format string, args ...interface{}) Issue
Newf returns a new lint issue using a formatter.
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) MaxSeverity ¶
func (i Issues) MaxSeverity() rules.Level
MaxSeverity gather the max severity in a collection of issues.
type Outcome ¶
type Outcome map[string]Issues
Outcome represents outcomes resulting from sanitization pass.
func (Outcome) Filter ¶ added in v0.6.2
func (o Outcome) Filter(level rules.Level) Outcome
Filter filters outcomes based on lint level.
func (Outcome) For ¶
func (o Outcome) For(section, group string) Issues
For returns issues for a given section/group.
func (Outcome) MarshalJSON ¶ added in v0.20.0
func (o Outcome) MarshalJSON() ([]byte, error)
func (Outcome) MarshalYAML ¶ added in v0.20.0
func (o Outcome) MarshalYAML() (interface{}, error)
func (Outcome) MaxGroupSeverity ¶
func (o Outcome) MaxGroupSeverity(section, group string) rules.Level
MaxGroupSeverity scans the issues and reports the highest severity.
func (Outcome) MaxSeverity ¶
func (o Outcome) MaxSeverity(section string) rules.Level
MaxSeverity scans the issues and reports the highest severity.