calculators

package
v0.0.0-...-86aec00 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPerCandidateScore = 30

Variables

This section is empty.

Functions

func GetSoftwaresToCalculate

func GetSoftwaresToCalculate(s *soft.Software, checkDependencies bool) []*soft.Software

Returns a list of softwares to compute a score for. If checkDependencies is true, include dependency softwares with a depth of 1 in the dependency tree

func New

func New(logger *slog.Logger, t soft.CalculatorType, checkDependencies bool) soft.Calculator

Provides a based on input type. Falls back on DefaultCalculator

NOTE: Should DefaultCalculator be renamed to SemverCalculator and MetaCalculator be renamed to DefaultCalculator?

Types

type CandidateCountCalculator

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

func (*CandidateCountCalculator) CalculateObsolescenceScore

func (c *CandidateCountCalculator) CalculateObsolescenceScore(s *soft.Software) error

type DefaultCalculator

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

The default calculator parses versions using Semantic Versioning. It takes the last version available and computes the obsolescence score:

x major versions late = x * 50

y minor versions late = y * 5

z patch versions late = z * 1

func (*DefaultCalculator) CalculateObsolescenceScore

func (c *DefaultCalculator) CalculateObsolescenceScore(s *soft.Software) error

Compute Obsolescence score by comparing current and last version and computes the obsolescence score

x major versions late = m * 50

y minor versions late = y * 5

z patch versions late = z * 1

type MetaCalculator

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

func (*MetaCalculator) CalculateObsolescenceScore

func (c *MetaCalculator) CalculateObsolescenceScore(s *software.Software) error

Entrypoint calculator which supports softwares with dependencies having different Calculator Types

type ReleaseDateCalculator

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

func (*ReleaseDateCalculator) CalculateObsolescenceScore

func (c *ReleaseDateCalculator) CalculateObsolescenceScore(s *soft.Software) error

type SkipCalculator

type SkipCalculator struct{}

Accepts the arbitrarily set score by the source

func (*SkipCalculator) CalculateObsolescenceScore

func (c *SkipCalculator) CalculateObsolescenceScore(s *soft.Software) error

Jump to

Keyboard shortcuts

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