Documentation ¶
Index ¶
- Variables
- type EvaluationConfig
- type LicenseEvaluation
- type LicenseEvaluations
- func (le LicenseEvaluations) EmptyPackages() []string
- func (le LicenseEvaluations) Failed(r grant.Rule) LicenseEvaluations
- func (le LicenseEvaluations) GetLicenses() []string
- func (le LicenseEvaluations) IsFailed() bool
- func (le LicenseEvaluations) Len() int
- func (le LicenseEvaluations) Less(i, j int) bool
- func (le LicenseEvaluations) Licenses(pkg string) []grant.License
- func (le LicenseEvaluations) Packages(license string) []string
- func (le LicenseEvaluations) Swap(i, j int)
- type Reason
- type Result
- type ResultSummary
- type Results
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 (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 (le LicenseEvaluations) Failed(r grant.Rule) LicenseEvaluations
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 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) Summary ¶
func (rs Results) Summary() ResultSummary
func (Results) UserInputs ¶
Click to show internal directories.
Click to hide internal directories.