evalutation

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ReasonNoLicenseFound      = "no license found"
	ReasonLicenseDeniedPolicy = "license denied by policy"
	ReasonLicenseAllowed      = "license allowed by policy"
	ReasonLicenseDeniedOSI    = "license not OSI approved"
)
View Source
var (
	RuleNameNotOSIApproved = "not OSI"
)

Functions

This section is empty.

Types

type EvaluationConfig

type EvaluationConfig struct {
	// Policy is the policy to evaluate against
	// if non is supplied, the default policy is used (grant.DefaultPolicy())
	Policy grant.Policy
	// CheckNonSPDX is true if non-SPDX licenses should be checked
	CheckNonSPDX bool
	// OsiApproved is true if only OSI approved licenses are the only ones allowed
	OsiApproved bool
}

func DefaultEvaluationConfig

func DefaultEvaluationConfig() EvaluationConfig

type LicenseEvaluation

type LicenseEvaluation struct {
	// inputs into evaluation...
	License grant.License  // the license that we evaluated
	Package *grant.Package // any artifact license is evaluated with

	// what's used to evaluate...
	Policy grant.Policy // what the determination was made against

	// the output of an evaluation...
	Reason []Reason // reasons that the evaluation value the way it is
	Pass   bool     // The final evaluation
}

func NewLicenseEvaluation

func NewLicenseEvaluation(license grant.License, pkg *grant.Package, policy grant.Policy, reasons []Reason, pass bool) LicenseEvaluation

func (LicenseEvaluation) RuleApplied

func (le LicenseEvaluation) RuleApplied(r grant.Rule) bool

type LicenseEvaluations

type LicenseEvaluations []LicenseEvaluation

func NewLicenseEvaluations

func NewLicenseEvaluations(ec EvaluationConfig, c grant.Case) LicenseEvaluations

func (LicenseEvaluations) EmptyPackages

func (le LicenseEvaluations) EmptyPackages() []string

func (LicenseEvaluations) Failed

func (LicenseEvaluations) GetLicenses

func (le LicenseEvaluations) GetLicenses() []string

func (LicenseEvaluations) IsFailed

func (le LicenseEvaluations) IsFailed() bool

func (LicenseEvaluations) Len

func (le LicenseEvaluations) Len() int

func (LicenseEvaluations) Less

func (le LicenseEvaluations) Less(i, j int) bool

func (LicenseEvaluations) Licenses

func (le LicenseEvaluations) Licenses(pkg string) []grant.License

func (LicenseEvaluations) Packages

func (le LicenseEvaluations) Packages(license string) []string

func (LicenseEvaluations) Swap

func (le LicenseEvaluations) Swap(i, j int)

type Reason

type Reason struct {
	Detail   string
	RuleName string
}

func NewReason added in v0.1.2

func NewReason(detail, ruleName string) Reason

type Result

type Result struct {
	Case        grant.Case
	Evaluations LicenseEvaluations
	Pass        bool
}

Result is the result of a policy evaluation It combines the supplied case with the evaluation results

type ResultSummary

type ResultSummary struct {
	CompliantPackages int `json:"compliant_packages" yaml:"compliant_packages"`
	PackageViolations int `json:"package_violations" yaml:"package_violations"`
	IgnoredPackages   int `json:"ignored_packages" yaml:"ignored_packages"`
	LicenseViolations int `json:"license_violations" yaml:"license_violations"`
	CompliantLicenses int `json:"compliant_licenses" yaml:"compliant_licenses"`
	IgnoredLicenses   int `json:"ignored_licenses" yaml:"ignored_licenses"`
}

type Results

type Results []Result

func NewResults

func NewResults(ec EvaluationConfig, cases ...grant.Case) (r Results)

func (Results) GetFailedEvaluations

func (rs Results) GetFailedEvaluations(userInput string, rule grant.Rule) LicenseEvaluations

GetFailedEvaluations returns a map of user input to slice of failed license evaluations for that input

func (Results) IsFailed

func (rs Results) IsFailed() bool

func (Results) Summary

func (rs Results) Summary() ResultSummary

func (Results) UserInputs

func (rs Results) UserInputs() []string

Jump to

Keyboard shortcuts

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