score

package
v0.0.0-...-e0f7ac1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package score defines interface and generic receiver to be implemented by each criteria evaluator

Index

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

func Rank(value float64) string

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) Desc

func (c *Evaluator) Desc() string

Desc returns the criteria description

func (*Evaluator) Name

func (c *Evaluator) Name() string

Name returns the criteria name

func (*Evaluator) NewResponse

func (c *Evaluator) NewResponse(score float64, weight float64, msg string, details []*exago.EvaluatorResponse) *exago.EvaluatorResponse

NewResponse creates an EvaluatorResponse instance

func (*Evaluator) Setup

func (c *Evaluator) Setup()

Setup is called before Calculate

func (*Evaluator) URL

func (c *Evaluator) URL() string

URL returns the criteria URL

Jump to

Keyboard shortcuts

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