Documentation
¶
Overview ¶
Package score defines interface and generic receiver to be implemented by each criteria evaluator
Index ¶
- func Process(data exago.Data) (score float64, details []*exago.EvaluatorResponse)
- func Rank(value float64) string
- type CriteriaEvaluator
- type Evaluator
- func (c *Evaluator) Calculate(d exago.Data) *exago.EvaluatorResponse
- func (c *Evaluator) Desc() string
- func (c *Evaluator) Name() string
- func (c *Evaluator) NewResponse(score float64, weight float64, msg string, details []*exago.EvaluatorResponse) *exago.EvaluatorResponse
- func (c *Evaluator) Setup()
- func (c *Evaluator) URL() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Process ¶
func Process(data exago.Data) (score float64, details []*exago.EvaluatorResponse)
Process triggers criterias evaluation, calling each evaluator in a goroutine We compute the weighted average based on the overall evaluator weights and scores
func Rank ¶
Rank computes a rank given a decimal score Quite simply, we divide the score by 10 and use floor(x) to get the greatest integer value less than or equal to x
Afterwards we get the rank by a map lookup with the pow index if the index is not found we return the worst rank :P We add a plus (+) or minus (-) sign to the rank if the score is either in lower or upper bound of the range.
Types ¶
type CriteriaEvaluator ¶
type CriteriaEvaluator interface { Calculate(exago.Data) *exago.EvaluatorResponse Name() string Setup() }
CriteriaEvaluator is the interface that must be implemented by a criteria evaluator.
func CheckListEvaluator ¶
func CheckListEvaluator() CriteriaEvaluator
CheckListEvaluator measures a score based on given checklist criterias
func CodeStatsEvaluator ¶
func CodeStatsEvaluator() CriteriaEvaluator
CodeStatsEvaluator measures a score based on various metrics of code stats such as ratio LOC/CLOC and so on...
func LintMessagesEvaluator ¶
func LintMessagesEvaluator() CriteriaEvaluator
LintMessagesEvaluator measures a score based on the output of gometalinter
func TestCoverageEvaluator ¶
func TestCoverageEvaluator() CriteriaEvaluator
TestCoverageEvaluator measures a score based on test coverage
func TestDurationEvaluator ¶
func TestDurationEvaluator() CriteriaEvaluator
TestDurationEvaluator measures a score based on test duration
func ThirdPartiesEvaluator ¶
func ThirdPartiesEvaluator() CriteriaEvaluator
ThirdPartiesEvaluator measures a score based on various metrics of imports for now only the # of 3rd-party packages.
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
Evaluator is a type that implements CriteriaEvaluator by allowing nil values but otherwise delegating to another ValueConverter.
func (*Evaluator) Calculate ¶
func (c *Evaluator) Calculate(d exago.Data) *exago.EvaluatorResponse
Calculate computes the criteria evaluation score
func (*Evaluator) NewResponse ¶
func (c *Evaluator) NewResponse(score float64, weight float64, msg string, details []*exago.EvaluatorResponse) *exago.EvaluatorResponse
NewResponse creates an EvaluatorResponse instance