score

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

Package score implements the standalone reputation scoring model using a v3 risk-weighted categorical algorithm with five categories: code provenance, identity, engagement, community, and behavioral. It exposes Compute, Signals, category weights, and ModelVersion.

Index

Constants

View Source
const ModelVersion = "3.2.0"

ModelVersion is the current scoring model version.

Variables

View Source
var (
	CategoryProvenanceWeight = provenanceWeight
	CategoryIdentityWeight   = ageWeight + associationWeight + profileWeight
	CategoryEngagementWeight = proportionWeight + recencyWeight + prAcceptWeight
	CategoryCommunityWeight  = followerWeight + repoCountWeight
	CategoryBehavioralWeight = burstWeight + forkOnlyWeight
)

Exported category weights derived from signal constants above.

Functions

func Compute

func Compute(s Signals) float64

Compute returns a reputation score in [0.0, 1.0] using the v3 weighted model.

Types

type CategoryWeight

type CategoryWeight struct {
	Name   string  `json:"name" yaml:"name"`
	Weight float64 `json:"weight" yaml:"weight"`
}

CategoryWeight describes a scoring category and its weight.

func Categories

func Categories() []CategoryWeight

Categories returns the model's scoring categories with their weights.

type Signals

type Signals struct {
	Suspended         bool  // Account suspended
	Commits           int64 // Author's commit count
	UnverifiedCommits int64 // Commits without verified signatures
	TotalCommits      int64 // Repo-wide total commits
	TotalContributors int   // Repo-wide contributor count
	AgeDays           int64 // Days since account creation
	OrgMember         bool  // Member of repo owner's org
	LastCommitDays    int64 // Days since most recent commit
	Followers         int64 // GitHub follower count
	Following         int64 // Following count (for ratio)
	PublicRepos       int64 // Public repository count

	// v3 signals
	AuthorAssociation string // OWNER, MEMBER, COLLABORATOR, CONTRIBUTOR, FIRST_TIME_CONTRIBUTOR, NONE
	HasBio            bool   // Profile has bio
	HasCompany        bool   // Profile has company
	HasLocation       bool   // Profile has location
	HasWebsite        bool   // Profile has website/blog
	PRsMerged         int64  // Global merged PR count
	PRsClosed         int64  // Global closed-without-merge PR count
	RecentPRRepoCount int64  // Distinct repos with PR events in last 90 days
	ForkedRepos       int64  // Owned repos that are forks
	TrustedOrgMember  bool   // Member of a caller-specified trusted org
}

Signals holds the raw inputs to the reputation model.

Jump to

Keyboard shortcuts

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