scorer

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CategoryStrucutral         category = "Structural"
	CategoryNTIAMiniumElements category = "NTIA-minimum-elements"
	CategorySemantic           category = "Semantic"
	CategoryQuality            category = "Quality"
	CategorySharing            category = "Sharing"
)
View Source
const EngineVersion = "4"
View Source
const MAX_SCORE float64 = 10.0

Variables

View Source
var CriteriaArgMap = map[CriteriaArg]string{
	DOCLICENCE:               string(docShareLicense),
	COMPNORESTRICLICENCE:     string(compWithRestrictedLicenses),
	COMPPRIMARYPURPOSE:       string(compWithPrimaryPackages),
	COMPNODEPRECATLICENCE:    string(compWithNoDepLicenses),
	COMPVALIDLICENCE:         string(compWithValidLicenses),
	COMPCHECKSUMS:            string(compWithChecksums),
	COMPLICENCE:              string(compWithLicenses),
	DOCALLREQFILEDS:          string(docWithAllRequiredFields),
	DOCTIMESTAMP:             string(docWithTimestamp),
	DOCAUTHOR:                string(docWithAuthors),
	DOCRELATIONSHIP:          string(docWithRelations),
	COMPUNIQIDS:              string(compWithUniqID),
	COMPVERSION:              string(compWithVersion),
	COMPNAME:                 string(compWithNames),
	COMPSUPPLIERNAME:         string(compSupplierName),
	SPECPARSABLE:             string(specIsParsable),
	SPECFILEFORMAT:           string(specFileFormat),
	SPECVERSION:              string(specVersion),
	SBOMSPEC:                 string(spec),
	COMPANYVULNERABILITYID:   string(compWithAnyLookupId),
	COMPMULTIVULNERABILITYID: string(compWithMultipleLookupId),
	DOCCREATORTOOL:           string(docWithCreator),
}

Functions

func CategorieMapWithCriteria

func CategorieMapWithCriteria(categorie string) []string

Types

type CriteriaArg

type CriteriaArg string
const (
	DOCLICENCE               CriteriaArg = "doc-licence"
	COMPNORESTRICLICENCE     CriteriaArg = "comp-no-restric-licence"
	COMPPRIMARYPURPOSE       CriteriaArg = "comp-primary-purpose"
	COMPNODEPRECATLICENCE    CriteriaArg = "comp-no-deprecat-licence"
	COMPVALIDLICENCE         CriteriaArg = "comp-valid-licence"
	COMPCHECKSUMS            CriteriaArg = "comp-checksums"
	COMPLICENCE              CriteriaArg = "comp-licence"
	DOCALLREQFILEDS          CriteriaArg = "doc-all-req-fileds"
	DOCTIMESTAMP             CriteriaArg = "doc-timestamp"
	DOCAUTHOR                CriteriaArg = "doc-author"
	DOCRELATIONSHIP          CriteriaArg = "doc-relationship"
	COMPUNIQIDS              CriteriaArg = "comp-uniq-ids"
	COMPVERSION              CriteriaArg = "comp-version"
	COMPNAME                 CriteriaArg = "comp-name"
	COMPSUPPLIERNAME         CriteriaArg = "comp-supplier-name"
	SPECPARSABLE             CriteriaArg = "spec-parsable"
	SPECFILEFORMAT           CriteriaArg = "spec-file-format"
	SPECVERSION              CriteriaArg = "spec-version"
	SBOMSPEC                 CriteriaArg = "sbom-spec"
	COMPANYVULNERABILITYID   CriteriaArg = "comp-any-vulnerability-id"
	COMPMULTIVULNERABILITYID CriteriaArg = "comp-multi-vulnerability-id"
	DOCCREATORTOOL           CriteriaArg = "doc-creator-tool"
)

type Option

type Option func(s *Scorer)

func WithCategory

func WithCategory(c string) Option

func WithFeature

func WithFeature(f []string) Option

type Score

type Score interface {
	Category() string
	Feature() string
	Ignore() bool
	Score() float64
	Descr() string
	MaxScore() float64
}

type Scorer

type Scorer struct {
	// contains filtered or unexported fields
}

func NewScorer

func NewScorer(ctx context.Context, doc sbom.Document, opts ...Option) *Scorer

func (*Scorer) Score

func (s *Scorer) Score() Scores

type Scores

type Scores interface {
	Count() int
	AvgScore() float64
	ScoreList() []Score
	CatScores() map[string]float64
}

Jump to

Keyboard shortcuts

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