vet

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check interface {
	Info() CheckInfo

	Init(ws leeway.Workspace) error
	RunPkg(pkg *leeway.Package) ([]Finding, error)
	RunCmp(pkg *leeway.Component) ([]Finding, error)
}

Check implements a vet check

func Checks

func Checks() []Check

Checks returns a list of all available checks

func ComponentCheck

func ComponentCheck(name, desc string, chk func(pkg *leeway.Component) ([]Finding, error)) Check

ComponentCheck produces a new check for a leeway component

func PackageCheck

func PackageCheck(name, desc string, tpe leeway.PackageType, chk func(pkg *leeway.Package) ([]Finding, error)) Check

PackageCheck produces a new check for a leeway package

type CheckInfo

type CheckInfo struct {
	Name          string
	Description   string
	PackageCheck  bool
	AppliesToType *leeway.PackageType
}

CheckInfo describes a check

type Finding

type Finding struct {
	Check       string
	Component   *leeway.Component
	Package     *leeway.Package
	Description string
	Error       bool
}

Finding describes a check finding. If the package is nil, the finding applies to the component

func Run

func Run(workspace leeway.Workspace, options ...RunOpt) ([]Finding, []error)

Run runs all checks on all packages

func (Finding) MarshalJSON

func (f Finding) MarshalJSON() ([]byte, error)

MarshalJSON marshals a finding to JSON

type RunOpt

type RunOpt func(*runOptions)

RunOpt modifies the run behaviour

func OnComponents

func OnComponents(n StringSet) RunOpt

OnComponents makes run check these components only

func OnPackages

func OnPackages(n StringSet) RunOpt

OnPackages makes run check these packages only

func WithChecks

func WithChecks(n []string) RunOpt

WithChecks runs these checks only

type StringSet

type StringSet map[string]struct{}

StringSet identifies a string as part of a set

Jump to

Keyboard shortcuts

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