badges

package
v0.0.0-...-efd69ef Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CHECK_RENAMES = map[string]string{
	"BUS_FACTOR": "CONTRIBUTOR_ABSENCE_FACTOR",
}

nolint:staticcheck

Functions

func GetBadgeFile

func GetBadgeFile(ctx context.Context, badgeID string, level string) ([]byte, error)

Types

type Badge

type Badge struct {
	BadgeName             string `json:"badgeName"`
	BadgeID               string `json:"badgeId"`
	BadgeLevel            string `json:"badgeLevel"`
	BadgeURL              string `json:"badgeUrl"`
	BadgeGranted          bool   `json:"badgeGranted"`
	BadgeInformationURI   string `json:"badgeInformationUri"`
	IsHighestGrantedBadge bool   `json:"isHighestGrantedBadge"`

	BadgeExplanation BadgeExplanation `json:"badgeExplanation"`
	BadgeDescription string           `json:"badgeDescription"`
}

func Eval

func Eval(repositoryURL string, observations []observe.Observation, badgeConfig []config.BadgeConfig) []Badge

func GetBestLevel

func GetBestLevel(badges []Badge, badgeID string) (Badge, error)

type BadgeExplanation

type BadgeExplanation struct {
	Criteria []Criteria `json:"criteria"`
}

type Criteria

type Criteria struct {
	Description string                 `json:"description"`
	Value       any                    `json:"value"`
	Status      Status                 `json:"status"`
	RuleID      string                 `json:"ruleId"`
	Threshold   config.ThresholdConfig `json:"threshold,omitempty"`
	BadgeID     string                 `json:"badgeId"`
	BadgeLevel  string                 `json:"badgeLevel"`
	Evidence    string                 `json:"evidence,omitempty"`
}

type Status

type Status string
const (
	// The rule specified by ruleId (§3.27.5), ruleIndex (§3.27.6), and/or rule (§3.27.7)
	// was evaluated, and no problem was found.
	StatusPass             Status = "pass"
	StatusDenied           Status = "fail"
	StatusMissingData      Status = "notApplicable" // this is for checks that could not be determined due to missing data like no tickets etc.
	StatusTechnicalFailure Status = "open"          // this is for technically failed checks
)

func EvaluateAgainstThreshold

func EvaluateAgainstThreshold(value observe.ObservationValue, threshold config.ThresholdConfig) Status

Source Files

  • badges.go
  • check.go

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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