scorer

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Feature filterType = iota
	Category
	Mix
)
View Source
const EngineVersion = "7"
View Source
const MAX_SCORE float64 = 10.0

Variables

This section is empty.

Functions

func DefaultConfig added in v0.0.15

func DefaultConfig() string

Types

type Cat added in v1.0.8

type Cat struct {
	Name        string     `yaml:"name"`
	Description string     `yaml:"description"`
	Features    []Features `yaml:"features"`
}

type Config added in v1.0.8

type Config struct {
	Metadata struct {
		Version     string `yaml:"version"`
		Description string `yaml:"description"`
		LastUpdated string `yaml:"last_updated"`
	} `yaml:"metadata"`

	Categories []*Cat `yaml:"categories"`
}

type Features added in v1.0.8

type Features struct {
	Name        string `yaml:"name"`
	Disabled    bool   `yaml:"ignore"`
	Description string `yaml:"description"`
}

type Filter added in v0.0.15

type Filter struct {
	Name     string
	Ftype    filterType
	Category string
}

func ReadConfigFile added in v0.0.15

func ReadConfigFile(path string) ([]Filter, error)

type Score

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

Score represent individual score, description for particular category and feature.

type Scorer

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

func NewScorer

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

func (*Scorer) AddFilter added in v0.0.15

func (s *Scorer) AddFilter(f Filter)

enable filtering by feature, category, or mix of both for scoring checks

func (*Scorer) AllScores added in v0.0.15

func (s *Scorer) AllScores() Scores

func (*Scorer) Score

func (s *Scorer) Score() Scores

type Scores

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

Scores represent list of all the score

Jump to

Keyboard shortcuts

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