Documentation ¶
Overview ¶
Package policy provides definitions and functionality related to dependency policies
Index ¶
Constants ¶
const ( // Allow is a rule kind that enumerates accepted dependencies Allow constraintKind = "allow" // Forbid is a rule kind that enumerates forbidden dependencies Forbid constraintKind = "forbid" )
const ( // Error error level Error errorLevel = "error" // Warn error level Warn errorLevel = "warn" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CanonicalConstraint ¶
type CanonicalConstraint struct {
// contains filtered or unexported fields
}
CanonicalConstraint is a plain raw (ie without references to components) dependency constraint
func (CanonicalConstraint) String ¶
func (c CanonicalConstraint) String() string
type CheckResult ¶
CheckResult models the result of a dependency checking
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
Checker models a dependencies constraints checker
func NewChecker ¶
NewChecker yields a dependencies constraint checker
type Constraint ¶
type Constraint struct { Name string Scope string Kind constraintKind Deps string OnBreak errorLevel }
Constraint represents the set of dependency constraints to enforce on a set of modules
type Policy ¶
type Policy struct { Components map[string]interface{} Classes map[string]interface{} Constraints []Constraint // contains filtered or unexported fields }
Policy represents the set of dependency constraints to enforce
func NewPolicyFromJSON ¶
NewPolicyFromJSON builds a Policy from a JSON
func (*Policy) ComponentsForPackage ¶
ComponentsForPackage yields all components matching the given package Ideally, a package should match a single component but it will be not always the case
func (Policy) GetApplicableConstraints ¶
func (p Policy) GetApplicableConstraints(pkg string) (constraints []CanonicalConstraint)
GetApplicableConstraints yields constraints applicable to a given package