census

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: Apache-2.0 Imports: 6 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 census holds the shape and the shrink-only bookkeeping every rule-corpus census shares.

Two censuses — formwork-universal-cure-census and formwork-anchor-census — ask different questions of .formwork/rules/*.yaml and then do the IDENTICAL thing with the answer: key each flagged arm as FILE:ARM-ID, reconcile that against a per-arm known-debt list, and fail on a new offender OR on a stale entry. Detection is the part that differs and stays in each tool; this is the part that does not.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadDebtList

func ReadDebtList(path string) (map[string]bool, error)

ReadDebtList loads a known-debt allowlist: one FILE:ARM-ID key per line, `#` comments and blanks ignored.

A missing file is returned as an error, never as an empty set: deleting the allowlist would otherwise read as "no debt" and silently pass every arm that was being carried.

func Reconcile

func Reconcile(w io.Writer, ruleID string, flags []Finding, debt map[string]bool, why string) int

Reconcile writes the verdict for one census run and returns the problem count: new offenders plus stale entries. why is the one-line explanation appended to each NEW report, so the failing arm carries its reason without the caller re-templating the whole line.

A zero return is the only pass. Carried debt is printed but not counted; a stale entry IS counted, which is what makes the list shrink-only.

Types

type Finding

type Finding struct {
	File string
	Line int
	Arm  string
}

Finding is one flagged rule arm: the repo-relative rule file, the 1-based line the verdict anchors to, and the arm's id for the report.

func (Finding) Key

func (f Finding) Key() string

Key is the known-debt key for a finding.

Per ARM, not per FILE. A file-keyed list waves through a NEW offending arm added to any listed file, which is the hole the ratchets exist to close; it also leaves an entry live after one arm of a two-arm file is cured, so nothing forces the entry out.

Jump to

Keyboard shortcuts

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