coverage

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package coverage places each gathered PR and change with its nearest proposed capability, by the files it touches against the files and clusters the capability's own citations touch, so recovery reads them and not only what propose cited. A file many capabilities touch counts for little. An item is placed only when at least half its files, by weight, are near the capability, and chores (dependency bumps, CI, formatting) are never placed. It also says what no capability got: the gathered PRs placed nowhere, and the clusters of files no capability's citations touch. It is deterministic and starts no session.

Index

Constants

View Source
const Low = 20

Low is the share of gathered PRs, or of clusters, left with no capability past which coverage is low, in percent. A first guess, to be tuned from real runs.

View Source
const MinShare = 50

MinShare is the share of an item's files, in percent, that must be in a capability's footprint or its directories for the item to be placed with it. A first guess, to be tuned from real runs.

Variables

This section is empty.

Functions

func Chore added in v0.0.5

func Chore(subject string, files []string) bool

Chore reports whether an item with this subject or title and these files is a chore: its subject says so, or every file it touches is a dependency file or CI, formatter or linter configuration.

func PROf

func PROf(ch store.GatheredChange) int

PROf is the number of the PR change ch came from, or 0.

func Place

func Place(g store.Gather, caps []mapping.Capability) (Placement, Report)

Place places each gathered PR and change no capability cites with the capability whose footprint holds the most of its files, then the most of its files' directories, each file weighed by how many footprints hold it (weights); a tie goes to the capability proposed first. An item is placed nowhere when less than MinShare percent of its files' weight is near that capability, when all its files are held by most footprints, or when it is a Chore. A PR's files are those of the changes that name it. It returns the placement and the report.

func Text

func Text(r Report) string

Text is r for a person: what propose cited, what was placed by files and what was left, the clusters no capability touches, the largest first, and, when coverage is low, that it is.

func Warn

func Warn(w io.Writer, r Report)

Warn says on w, as init's warning, when r's coverage is low; init goes on.

Types

type Placement

type Placement struct {
	PRs     map[string][]int
	Changes map[string][]string // full ids
}

Placement is what each capability reads beyond its citations, by name: the PRs and changes placed with it.

type Report

type Report struct {
	PRs       int               `json:"prs"`
	Cited     int               `json:"cited"`
	Placed    int               `json:"placed"`
	Unplaced  int               `json:"unplaced"`
	Unfiled   int               `json:"unfiled"`
	Chores    int               `json:"chores"`
	Clusters  int               `json:"clusters"`
	Uncovered []reading.Cluster `json:"uncovered"`
	Low       bool              `json:"low"`
}

Report is how far the proposal reaches into the gather. Cited counts the gathered PRs some capability cites, Placed those placed by their files, and Unplaced those neither: Unfiled of them because no gathered change names the PR, so it has no files to place it by, and Chores of them because they are chores, which are never placed. Clusters counts the clusters of files that change together, and Uncovered lists those no capability's citations touch, each with its first reading.ClusterPaths paths.

Jump to

Keyboard shortcuts

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