checker

package
v1.11.4-bzc.6 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

README

Tools

This repository contains tools useful in building Istio.

Performance Testing

See perf for details on how to setup the performance and stability tests.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IgnoreTestLinterData = true

IgnoreTestLinterData skips over unit tests

Functions

func Check

func Check(paths []string, factory RulesFactory, allowlist *Allowlist, report *Report) error

Check checks the list of files, and write to the given Report.

Types

type Allowlist

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

Allowlist determines if rules are allowlisted for the given paths.

func NewAllowlist

func NewAllowlist(ruleAllowlist map[string][]string) *Allowlist

NewAllowlist creates and returns an Allowlist object.

func (*Allowlist) Apply

func (wl *Allowlist) Apply(path string, rule Rule) bool

Apply returns true if the given rule is allowlisted for the given path.

type FileVisitor

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

FileVisitor visits the go file syntax tree and applies the given rules.

func (*FileVisitor) Visit

func (fv *FileVisitor) Visit(node ast.Node) ast.Visitor

Visit checks each node and runs the applicable checks.

type Report

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

Report populates lint report.

func NewLintReport

func NewLintReport() *Report

NewLintReport creates and returns a Report object.

func (*Report) AddItem

func (lr *Report) AddItem(pos token.Position, id string, msg string)

AddItem creates a new lint error report.

func (*Report) AddString

func (lr *Report) AddString(msg string)

AddString creates a new string line in report.

func (*Report) Items

func (lr *Report) Items() []string

Items returns formatted report as a string slice.

type Rule

type Rule interface {
	// GetID returns ID of the rule in string, ID is equal to the file name of that rule.
	GetID() string
	// Check verifies if aNode passes rule check. If verification fails lrp creates a report.
	Check(aNode ast.Node, fs *token.FileSet, lrp *Report)
}

Rule is interface for defining lint rules.

type RulesFactory

type RulesFactory interface {
	// GetRules returns a list of rules used to check against the files.
	GetRules(absp string, info os.FileInfo) []Rule
}

RulesFactory is interface to get Rules from a file path.

Jump to

Keyboard shortcuts

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