validator

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReasonNotAllow = iota + 1
	ReasonRejected
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	Folder      string `yaml:"folder"`
	Subpackages bool   `yaml:"subpackages"`
	Rules       []Rule `yaml:"rules"`
}

func (Check) ValidateImports

func (chk Check) ValidateImports(path string, imports []*ast.ImportSpec, debug bool) []ValidationError

type Config

type Config struct {
	Checks []Check `yaml:"imports-checks"`
}

type Reason

type Reason int

type Rule

type Rule struct {
	Prefix string   `yaml:"prefix"`
	Reject []string `yaml:"reject"`
	Allow  []string `yaml:"allow"`
}

type ValidationError

type ValidationError struct {
	Path       string
	Check      Check
	Rule       Rule
	ImportPath string
	Reason     Reason
}

func Validate

func Validate(root string, checks []Check, debug bool) ([]ValidationError, error)

Jump to

Keyboard shortcuts

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