rulesdoc

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 11 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 rulesdoc reads the architecture rules from the test sources of internal/archtest and renders their reference page.

Index

Constants

View Source
const SelfTestHelper = "flagged"

SelfTestHelper is the helper every self-test calls; a test that calls it is no rule.

Variables

This section is empty.

Functions

func Page

func Page(rules []Rule) string

Page renders the architecture rules reference page.

Types

type Allowlist

type Allowlist struct {
	Name    string
	Entries []Entry
}

Allowlist is a package-level map[string]string, or slice of a struct of strings and ints, that a rule test reaches from its body.

type Entry

type Entry struct {
	Item   []string
	Status Status
	Reason string
}

Entry is one allowlist entry: its strings, and its reason and triage when the list has reasons.

type Rule

type Rule struct {
	Test string
	File string
	// Rule is the sentence after "<Test> checks that " in the test's doc
	// comment, or empty when the comment is missing or worded otherwise.
	Rule       string
	Allowlists []Allowlist
}

Rule is a rule test: a test of the package that does not call SelfTestHelper.

func Read

func Read(dir string) ([]Rule, error)

Read returns the rule tests of the test files in dir, sorted by name.

type Status

type Status string

Status is the triage of an allowlist entry against the architecture rules, read from its reason's prefix: "fix: " or "debt: ", none when it holds.

const (
	Holds Status = "holds"
	// Fix is an exception that does not hold and whose fix is mechanical.
	Fix Status = "fix"
	// Debt is an exception that does not hold and whose fix is a refactor.
	Debt Status = "debt"
)

Jump to

Keyboard shortcuts

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