analyzer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WeightForkRatio    = 0.25
	WeightGhostPct     = 0.20
	WeightStarVelocity = 0.15
	WeightWatcherRatio = 0.10
	WeightAccountAge   = 0.10
	WeightZeroFollower = 0.10
	WeightIssueRatio   = 0.10
)

Signal weight constants — must sum to 1.0.

Variables

This section is empty.

Functions

func CalculateSignals

func CalculateSignals(repo model.RepoInfo, summary model.StargazerSummary) []model.Signal

CalculateSignals computes all 7 signals from repo info and stargazer summary.

func ClassifyStargazer

func ClassifyStargazer(p model.StargazerProfile) model.StargazerClass

ClassifyStargazer assigns a StargazerClass based on the profile.

func ParseRepo

func ParseRepo(input string) (owner, repo string, err error)

ParseRepo splits "owner/repo" into its parts.

func Score

func Score(signals []model.Signal) (float64, model.Verdict)

Score computes the weighted composite trust score from signals and assigns a verdict.

func SummarizeStargazers

func SummarizeStargazers(profiles []model.StargazerProfile, totalStars int) model.StargazerSummary

SummarizeStargazers builds a StargazerSummary from classified profiles.

Types

type GitHubClient

type GitHubClient interface {
	FetchRepoInfo(ctx context.Context, owner, repo string) (model.RepoInfo, error)
	FetchTotalIssues(ctx context.Context, owner, repo string) (int, error)
	FetchStargazers(ctx context.Context, owner, repo string, totalStars int) ([]ghclient.StargazerEntry, error)
	FetchUserProfiles(ctx context.Context, logins []string) ([]model.StargazerProfile, int)
}

GitHubClient defines the GitHub API surface needed by the analyzer.

type RepoAnalyzer

type RepoAnalyzer struct {
	// contains filtered or unexported fields
}

RepoAnalyzer orchestrates the full analysis pipeline for a repository.

func NewRepoAnalyzer

func NewRepoAnalyzer(client GitHubClient) *RepoAnalyzer

NewRepoAnalyzer creates a new analyzer with the given GitHub client.

func (*RepoAnalyzer) Analyze

func (a *RepoAnalyzer) Analyze(ctx context.Context, owner, repo string, onProgress func(string)) (model.AnalysisResult, error)

Analyze runs the full analysis pipeline on a repo.

Jump to

Keyboard shortcuts

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