Help us shape the future of Go! Take the 2026 Go Developer Survey

hotspot

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package hotspot computes change-frequency × instability hotspot scores via a Catmull-Rom curve.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeChangeFrequencies

func ComputeChangeFrequencies(touchCounts map[string]int, totalCommits int) map[string]float64

ComputeChangeFrequencies computes change frequency as touchCount/totalCommits per package.

func ComputeScores

func ComputeScores(
	instabilities map[string]float64,
	changeFreqs map[string]float64,
	curve *CatmullRomCurve,
) map[string]PackageScore

ComputeScores computes hotspot scores for each package. hotspot = changeFreq * curve.Evaluate(instability).

Types

type CatmullRomCurve

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

CatmullRomCurve evaluates a Catmull-Rom spline that passes through the given control points.

func DefaultCurve

func DefaultCurve() *CatmullRomCurve

DefaultCurve returns a symmetric bell curve with peak at x=0.5. Control points: (0, 0.5), (0.5, 1), (1, 0.5).

func NewCatmullRomCurve

func NewCatmullRomCurve(points []ControlPoint) (*CatmullRomCurve, error)

NewCatmullRomCurve creates a Catmull-Rom curve from the given control points. Points must be sorted by X. At least 2 points are required. Phantom endpoints are generated by reflecting the first/last segment.

func (*CatmullRomCurve) Evaluate

func (c *CatmullRomCurve) Evaluate(xValue float64) float64

Evaluate returns the Y value of the curve at the given X. X is clamped to the range of the original control points.

type ControlPoint

type ControlPoint struct {
	X, Y float64
}

ControlPoint defines a point on the Catmull-Rom curve.

type PackageScore

type PackageScore struct {
	ChangeFreq   float64 `json:"ChangeFreq"`
	HotspotScore float64 `json:"HotspotScore"`
}

PackageScore holds the computed hotspot data for a single package.

Jump to

Keyboard shortcuts

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