trust

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// > Overall trust:                                      76%
	OverallTrustFormat = "%s\n%s:<TAB>%s\n"
)

Variables

This section is empty.

Functions

func Render

func Render(report *Report, info bool)

Render prints a report. If info is set to true, it prints it regardless of the verbosity, while if info is set to false it will print it only in verbose mode.

Types

type Factor

type Factor struct {
	// The raw value of this factor.
	Value float64

	// The % of trust given to the value, compared
	// to global references.
	TrustPercent float64
}

Factor represents one of the trust factors used to compte the trust score for a repository.

type FactorName

type FactorName string

FactorName is a typed string representing a Factor's name.

const (
	PrivateContributionFactor  FactorName = "Private contributions"
	ContributionScoreFactor    FactorName = "Weighted contributions"
	IssueContributionFactor    FactorName = "Created issues"
	CommitContributionFactor   FactorName = "Commits authored"
	RepoContributionFactor     FactorName = "Repositories"
	PRContributionFactor       FactorName = "Pull requests"
	PRReviewContributionFactor FactorName = "Code reviews"
	AccountAgeFactor           FactorName = "Account age (days)"
	Overall                    FactorName = "Overall trust"
)

All of the factors taken into account by Astronomer and shown in the report.

type Percentile

type Percentile string

Percentile is a typed string representing a percentile trust factor. It is a string instead of a float to allow the `encoding/json` package to marshal trust reports.

type Report

type Report struct {
	Factors     map[FactorName]Factor
	Percentiles map[Percentile]Factor
}

Report represents the result of the trust computation of a repository's stargazers. It contains every trust factor that has been computed.

func Compute

func Compute(ctx *context.Context, users []gql.User) (*Report, error)

Compute computes all trust factors for the stargazers of a repository.

Jump to

Keyboard shortcuts

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