lint

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: AGPL-3.0 Imports: 14 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 lint checks a spec repository against the rules in PROCESS.md. Every rule is a function returning findings; nothing here prints or exits.

Index

Constants

This section is empty.

Variables

View Source
var Rules = []Rule{
	{
		Code:    "L01",
		Check:   L01,
		Title:   "Front matter matches the schema",
		Summary: "Front matter is malformed, has an unknown key, a required key is missing or empty, or `as_of` is empty",
		Remedy:  "Fix the front matter",
		Since:   "v0.1.0-alpha.1",
		Changes: []Change{
			{Release: "v0.6.0", Summary: "Reports an unknown status at the `status` line rather than line 1"},
			{Release: "v0.6.0", Summary: "Reads a group's front matter, and reports an `as_of` left empty"},
			{Release: "v0.6.0", Summary: "Reports a warning rather than an error in a frozen document"},
			{Release: "v0.6.0", Summary: "Reports invalid YAML once, at the line it stops being valid, or at its first line in a block longer than 16 KiB, with no key reported missing, a missing or unclosed block once, and an empty list item"},
			{Release: "v0.6.0", Summary: "Reports a file that cannot be read, such as a symbolic link to nothing, where no command could open the repository"},
		},
	},
	{
		Code:    "L02",
		Check:   L02,
		Title:   "The identifier matches the filename",
		Summary: "`id` does not match the filename, or the filename is not `<NNNN>-<slug>.md`",
		Remedy:  "Rename the file, or correct `id`",
		Since:   "v0.1.0-alpha.1",
		Changes: []Change{
			{Release: "v0.6.0", Summary: "Reports an `id` that differs from the filename at the `id` line rather than line 1"},
			{Release: "v0.6.0", Summary: "Reports a warning rather than an error in a frozen document"},
			{Release: "v0.6.0", Summary: "Does not compare an `id` that did not parse, or is missing or empty"},
		},
	},
	{
		Code:    "L03",
		Check:   L03,
		Title:   "Identifiers are unique",
		Summary: "Two documents claim the same identifier",
		Remedy:  "Renumber the wrong one with `archdoc renumber <path>`, then correct each reference it lists that meant that one",
		Since:   "v0.1.0-alpha.1",
		Changes: []Change{
			{Release: "v0.6.0", Summary: "Reports a warning rather than an error when every document holding the identifier is frozen"},
		},
	},
	{
		Code:    "L04",
		Check:   L04,
		Title:   "References resolve",
		Summary: "A referenced identifier does not resolve or is listed twice, or a group's member names nothing or is listed twice",
		Remedy:  "Create the document, or correct the reference, the list or the group's list",
		Since:   "v0.1.0-alpha.1",
		Changes: []Change{
			{Release: "v0.6.0", Summary: "Reports a reference at its field's line rather than line 1"},
			{Release: "v0.6.0", Summary: "Reports a group member that resolves to nothing, or is listed twice"},
			{Release: "v0.6.0", Summary: "Reports a term's `named_by` that names no document"},
			{Release: "v0.6.0", Summary: "Reports a ref named in `depends` or `includes`, and a reference that is not an identifier any document can hold, as a warning rather than an error in a frozen document"},
			{Release: "v0.6.0", Summary: "Reports an identifier listed twice in `depends`, `updates`, `obsoletes` or `includes`, as a warning in a frozen document"},
		},
	},
	{
		Code:    "L05",
		Check:   L05,
		Title:   "Updates and obsoletes name accepted documents",
		Summary: "`updates`/`obsoletes` targets something not accepted, of the wrong type, or itself, or one document appears in both",
		Remedy:  "Accept the target, or correct the list",
		Since:   "v0.1.0-alpha.1",
		Changes: []Change{
			{Release: "v0.6.0", Summary: "Reports each finding at its field's line rather than line 1"},
			{Release: "v0.6.0", Summary: "Names a target's type with its article, as `an ADR` rather than `a adr`"},
			{Release: "v0.6.0", Summary: "Reports a warning rather than an error in a frozen document, except for a target that is not accepted and not frozen"},
		},
	},
	{
		Code:    "L06",
		Check:   L06,
		Title:   "Includes name accepted documents",
		Summary: "`includes` targets something not accepted",
		Remedy:  "Accept the target, or remove it from the page",
		Since:   "v0.1.0-alpha.1",
		Changes: []Change{
			{Release: "v0.6.0", Summary: "Reports a target that is not accepted at the `includes` line rather than line 1"},
		},
	},
	{
		Code:    "L07",
		Check:   L07,
		Title:   "Dates are consistent",
		Summary: "`decided` set without a terminal status, or before `created`, backfill dates disagree, or a ref's `as_of` is after `verified`",
		Remedy:  "Correct the dates",
		Since:   "v0.1.0-alpha.1",
		Changes: []Change{
			{Release: "v0.6.0", Summary: "Reports a fault in `decided` at the `decided` line rather than line 1"},
			{Release: "v0.6.0", Summary: "Reports a ref's `as_of` after its `verified`"},
			{Release: "v0.6.0", Summary: "Reports a warning rather than an error in a frozen document"},
			{Release: "v0.6.0", Summary: "Does not check the status against an empty one, or report `decided` unset where it did not parse"},
		},
	},
	{
		Code:    "L08",
		Check:   L08,
		Title:   "Required sections are present and in order",
		Summary: "A required section is missing, misnamed, out of order, or the closing section is not last, or `Rejection rationale` is present in a document that is not rejected",
		Remedy:  "Add or reorder. Titles must match exactly. Remove a `Rejection rationale` from a document that is not rejected",
		Since:   "v0.1.0-alpha.1",
		Changes: []Change{
			{Release: "v0.6.0", Summary: "No longer requires `Open questions` or `Changelog` in an RFC"},
			{Release: "v0.6.0", Summary: "Reports a warning rather than an error in a frozen document"},
			{Release: "v0.6.0", Summary: "Finds a heading after a paragraph holding a code span opened by three backticks or an unclosed `<!--`, which hid the headings after it"},
			{Release: "v0.6.0", Summary: "Finds a heading closed by `#` characters in a CRLF file, which it reported as missing"},
			{Release: "v0.6.0", Summary: "Does not read a heading written after the `-->` closing a comment block on the same line, which GitHub renders as part of the block"},
			{Release: "v0.6.0", Summary: "Reads a `<!--` in a heading as part of the heading's text where no `-->` closes it on the heading's line"},
			{Release: "v0.6.0", Summary: "Finds a heading after a fenced code block in a list item whose closing fence is indented with a tab, which hid the headings after it"},
			{Release: "v0.6.0", Summary: "Reads a setext heading as a section's heading, and no heading inside a blockquote, a list item or a footnote definition, nor a line that is a heading only once a comment on it is masked"},
			{Release: "v0.6.0", Summary: "Passes over a document whose body is longer than 131,072 bytes, which L23 reports"},
		},
	},
	{
		Code:    "L09",
		Check:   L09,
		Title:   "An accepted document has no open questions",
		Summary: "An accepted document still has content under `Open questions`",
		Remedy:  "Move each question to `Resolved questions` with its answer, and remove anything else",
		Since:   "v0.1.0-alpha.1",
		Changes: []Change{
			{Release: "v0.6.0", Summary: "Reports a warning rather than an error in a frozen document"},
			{Release: "v0.6.0", Summary: "Reads `Open questions` from top-level headings alone, a setext heading among them"},
			{Release: "v0.6.0", Summary: "Reports nothing in a body longer than 131,072 bytes, which L23 reports"},
		},
	},
	{
		Code:    "L10",
		Check:   L10,
		Title:   "The heading matches the front matter",
		Summary: "The H1 does not match the front matter",
		Remedy:  "Correct whichever is wrong",
		Since:   "v0.1.0-alpha.1",
		Changes: []Change{
			{Release: "v0.6.0", Summary: "Checks a group's H1 against its title"},
			{Release: "v0.6.0", Summary: "Reports a warning rather than an error in a frozen document"},
			{Release: "v0.6.0", Summary: "Does not compare a title or `id` that did not parse, or is missing or empty"},
			{Release: "v0.6.0", Summary: "Does not read an H1 written after the `-->` closing a comment block on the same line, which GitHub renders as part of the block"},
			{Release: "v0.6.0", Summary: "Reads a setext H1, and takes the H1 from the top-level headings alone"},
			{Release: "v0.6.0", Summary: "Passes over a document whose body is longer than 131,072 bytes, which L23 reports"},
		},
	},
	{
		Code:    "L11",
		Check:   L11,
		Title:   "Frozen documents are unchanged",
		Summary: "A frozen document changed, or was deleted",
		Remedy:  "Revert it. To change what it says, write a new document that updates or obsoletes it",
		Since:   "v0.1.0-alpha.1",
		Changes: []Change{
			{Release: "v0.6.0", Summary: "Judges what changed or was deleted against the merge base of HEAD and the branch, not the branch's tip, and warns once where the branch's `archdoc.json` cannot be read"},
			{Release: "v0.6.0", Summary: "Reads `branch` as the local branch, or `origin/<branch>`, never a tag of the same name"},
			{Release: "v0.6.0", Summary: "Follows a moved root, reading each revision's documents under its own root, where an edit or deletion made with the move passed"},
			{Release: "v0.6.0", Summary: "Stops lint with an error where git fails, rather than skipping the rule as being outside a git repository"},
			{Release: "v0.6.0", Summary: "Reports a changed frozen document where `GIT_LITERAL_PATHSPECS` is set in the environment, where every one passed"},
		},
	},
	{
		Code:    "L12",
		Check:   L12,
		Title:   "Spec pages include nothing obsolete",
		Summary: "A spec page includes something obsoleted (warning)",
		Remedy:  "Update the page and its `includes`",
		Since:   "v0.1.0-alpha.1",
		Changes: []Change{
			{Release: "v0.6.0", Summary: "Reports a stale page at the `includes` line rather than line 1"},
			{Release: "v0.6.0", Summary: "Names each obsolete document once"},
		},
	},
	{
		Code:    "L13",
		Check:   L13,
		Title:   "Refs are verified recently",
		Summary: "A ref's `verified` date is older than `ref_stale_days`, and it carries no `as_of` (warning)",
		Remedy:  "Re-check the content, then update `verified`. A record of an exchange carries `as_of` instead",
		Since:   "v0.1.0-alpha.1",
		Changes: []Change{
			{Release: "v0.6.0", Summary: "Reports a stale ref at the `verified` line rather than line 1"},
			{Release: "v0.6.0", Summary: "Does not report a ref carrying `as_of`"},
			{Release: "v0.6.0", Summary: "Does not report a ref whose `as_of` did not parse"},
		},
	},
	{
		Code:    "L14",
		Check:   L14,
		Title:   "Required sections are not empty",
		Summary: "A required section is empty",
		Remedy:  "Write it",
		Since:   "v0.1.0-alpha.1",
		Changes: []Change{
			{Release: "v0.6.0", Summary: "Reports an empty section after a paragraph holding an unclosed `<!--`, which hid it"},
			{Release: "v0.6.0", Summary: "Reports an empty section whose heading is closed by `#` characters in a CRLF file"},
			{Release: "v0.6.0", Summary: "Reports an empty section after a fenced code block in a list item whose closing fence is indented with a tab, which hid it"},
			{Release: "v0.6.0", Summary: "Reads a setext heading as a section's heading, and a section's text from the line after its underline"},
			{Release: "v0.6.0", Summary: "Reports nothing in a body longer than 131,072 bytes, which L23 reports"},
		},
	},
	{
		Code:    "L15",
		Check:   L15,
		Title:   "A term is defined in one paragraph",
		Summary: "A term's definition under `term/` is not exactly one paragraph",
		Remedy:  "Rewrite the definition as one paragraph beneath the H1",
		Since:   "v0.1.0-alpha.1",
		Changes: []Change{
			{Release: "v0.6.0", Summary: "Reads the definition as blocks to the end of the file, and reports any block that is not a paragraph and prose above the H1"},
			{Release: "v0.6.0", Summary: "Reports a blockquote after a lone carriage return, and a list or blockquote whose marker a comment left open in the paragraph would hide, rather than reading either as part of the paragraph before it"},
			{Release: "v0.6.0", Summary: "Reads a setext H1, and the definition from the line after its underline"},
			{Release: "v0.6.0", Summary: "Passes over a document whose body is longer than 131,072 bytes, which L23 reports"},
			{Release: "v0.6.0", Summary: "Reads the definition's blocks as goldmark reads them, passing over comment blocks and link reference definitions"},
			{Release: "v0.6.0", Summary: "Takes the H1 as the first top-level heading where that is of level one, and reports no paragraph in a term without one"},
		},
	},
	{
		Code:    "L16",
		Check:   L16,
		Title:   "Wiki links are resolved",
		Summary: "An unresolved `[[...]]` link",
		Remedy:  "Run `archdoc link`. In a heading, which it leaves as written, write the heading without it; after a `!`, which would make it an image, remove the `!`; in a terminal document outside a git repository, replace it by hand; in a frozen document, leave it as written",
		Since:   "v0.1.0-alpha.1",
		Changes: []Change{
			{Release: "v0.6.0", Summary: "Names the edit that clears a link in a heading, in a frozen document, and in a terminal document outside a git repository"},
			{Release: "v0.6.0", Summary: "Does not report a `[[...]]` in an indented code block or an HTML block"},
			{Release: "v0.6.0", Summary: "Reports a `[[...]]` after a code span opened by three backticks or an unclosed `<!--` in a paragraph"},
			{Release: "v0.6.0", Summary: "Does not report a `[[...]]` after the `-->` closing a comment block on the same line"},
			{Release: "v0.6.0", Summary: "Reports a `[[...]]` on the lines after a heading holding a `<!--` that no `-->` closes on the heading's line"},
			{Release: "v0.6.0", Summary: "Reports a `[[...]]` after a fenced code block in a list item whose closing fence is indented with a tab"},
			{Release: "v0.6.0", Summary: "Names the edit for a `[[...]]` in a setext heading as for one in an ATX heading"},
			{Release: "v0.6.0", Summary: "Reports nothing in a body longer than 131,072 bytes, which L23 reports"},
			{Release: "v0.6.0", Summary: "Reads a `[[...]]` from text as goldmark reads it, so not one with an escaped bracket, one in a link's text, or one whose label the document defines"},
			{Release: "v0.6.0", Summary: "Names removing the `!` as the edit that clears a `![[...]]`"},
		},
	},
	{
		Code:    "L17",
		Check:   L17,
		Title:   "Relative links resolve",
		Summary: "A relative link points at a missing file or heading, or leaves the repository",
		Remedy:  "Fix the path or the anchor",
		Since:   "v0.1.0-alpha.1",
		Changes: []Change{
			{Release: "v0.6.0", Summary: "Reports a link as leaving the repository only past the git repository holding `root`, where there is one, not past `root` itself"},
			{Release: "v0.6.0", Summary: "Skips a destination with a URI scheme, such as `tel:`, or a leading `/`, which it reported as not existing"},
			{Release: "v0.6.0", Summary: "Matches each component of a path in its exact case"},
			{Release: "v0.6.0", Summary: "Slugs a heading's anchor as GitHub does, from its rendered text, and reads a document's explicit anchors"},
			{Release: "v0.6.0", Summary: "Reads a link reference definition directly under a heading or block, and balanced or escaped parentheses in a bare destination"},
			{Release: "v0.6.0", Summary: "Reads link text that wraps across lines or holds brackets"},
			{Release: "v0.6.0", Summary: "Does not read a footnote definition, such as `[^1]: note`, as a link reference definition"},
			{Release: "v0.6.0", Summary: "Does not read a destination holding a space, such as `[a](x y.md)`, as a link to its first word"},
			{Release: "v0.6.0", Summary: "Reads a link reference definition in a CRLF file"},
			{Release: "v0.6.0", Summary: "Does not check a link in an HTML block"},
			{Release: "v0.6.0", Summary: "Checks a link after a code span opened by three backticks or an unclosed `<!--` in a paragraph"},
			{Release: "v0.6.0", Summary: "Does not check a link after the `-->` closing a comment block on the same line, or take a heading written there as an anchor"},
			{Release: "v0.6.0", Summary: "Checks a link on the lines after a heading holding a `<!--` that no `-->` closes on the heading's line"},
			{Release: "v0.6.0", Summary: "Checks a link after a fenced code block in a list item whose closing fence is indented with a tab"},
			{Release: "v0.6.0", Summary: "Gives a heading inside a blockquote, a list item or a referenced footnote definition an anchor, one indented under another definition included, in the order GitHub renders the headings, and renders a heading's anchor from its pieces as goldmark reads them"},
			{Release: "v0.6.0", Summary: "Checks a link into a document whose body is longer than 131,072 bytes without its fragment, and passes over the links in one"},
			{Release: "v0.6.0", Summary: "Reads links, images and link reference definitions as goldmark reads them, a definition behind a blockquote's marker anywhere included"},
			{Release: "v0.6.0", Summary: "Gives a setext heading an anchor, and none to a line that is not a heading on GitHub, such as `##` with no space after it"},
		},
	},
	{
		Code:    "L18",
		Check:   L18,
		Title:   "Dependencies are accepted",
		Summary: "`depends` names a document that is not accepted, other than one sharing the referring document's non-terminal status (warning)",
		Remedy:  "Usually accept the dependency first",
		Since:   "v0.1.0-alpha.1",
		Changes: []Change{
			{Release: "v0.6.0", Summary: "Reports a dependency at the `depends` line rather than line 1"},
		},
	},
	{
		Code:    "L19",
		Check:   L19,
		Title:   "No glossary page is left from before terms",
		Summary: "`spec/glossary.md` is left from before terms became files, and is no longer read (warning)",
		Remedy:  "Move its terms to `term/` with `archdoc term add`. Guide: `spec-pages.md`",
		Since:   "v0.5.0",
	},
	{
		Code:    "L20",
		Check:   L20,
		Title:   "Question sections are shaped as questions",
		Summary: "A question section is not shaped as questions: something before the first question; a question with no anchor, or sharing one with another heading; a heading beneath a question; an open question ending with a blockquote; a resolved question with no answer, an empty one, or another blockquote just before it; `Resolved questions` empty, misplaced or repeated",
		Remedy:  "Rewrite it in that shape: reword a clashing question, join two blockquotes with a line holding only `>`. Guide: `authoring.md`, Questions",
		Since:   "v0.6.0",
	},
	{
		Code:    "L21",
		Check:   L21,
		Title:   "The Changelog has the shape the tool reads",
		Summary: "A Changelog entry is undated, has a malformed or impossible date, has a date and no text, or is out of order or outside the document's dates; a block in the section is not a list, a comment or a link reference definition; or the heading is misspelt or repeated",
		Remedy:  "Date the entry, or rewrite the block as an entry or within one, and spell the heading `## Changelog`. Guide: `authoring.md`, The Changelog",
		Since:   "v0.6.0",
	},
	{
		Code: "L22",

		Title:   "Every acknowledgement names a warning",
		Summary: "An entry in `acknowledged` names a path that is not a document, a document that is not frozen, a code that is not an L rule, or a rule that reports no warning on the document",
		Remedy:  "Remove the entry from `acknowledged`",
		Since:   "v0.6.0",
	},
	{
		Code:    "L23",
		Check:   L23,
		Title:   "A body is short enough to read",
		Summary: "A document's body is longer than 131,072 bytes, so the tool does not read it, and the rules that read a body pass it over",
		Remedy:  "Split the document, or move what makes it long into a file it links to",
		Since:   "v0.6.0",
	},
	{
		Code:    "M01",
		Check:   M01,
		Title:   "No draft lands",
		Summary: "An RFC or ADR arrives on the configured branch as a draft",
		Remedy:  "Propose it with `archdoc propose` before it merges",
		Since:   "v0.6.0",
	},
	{
		Code:    "M02",
		Check:   M02,
		Title:   "An arriving document takes a free number",
		Summary: "A document arrives carrying an identifier a document on the configured branch already holds",
		Remedy:  "Rebase, then renumber the arriving one by path: `archdoc renumber <path>`",
		Since:   "v0.6.0",
	},
	{
		Code:    "M03",
		Check:   M03,
		Title:   "Status changes follow the lifecycle from the branch",
		Summary: "A change of status the lifecycle does not permit from the status on the configured branch, under that branch's `strict`",
		Remedy:  "Make one step at a time from the branch: where `strict` is on, merge the proposal first and give the verdict afterwards",
		Since:   "v0.6.0",
	},
	{
		Code:    "M04",
		Check:   M04,
		Title:   "A proposed document is withdrawn, not deleted",
		Summary: "A document proposed on the configured branch is deleted or renumbered",
		Remedy:  "Restore it, and withdraw it with `archdoc withdraw` if it is no longer wanted",
		Since:   "v0.6.0",
	},
}

Rules is every rule, in code order.

Functions

This section is empty.

Types

type BranchFile

type BranchFile struct {
	Status repo.Status
	Err    error
}

BranchFile is a document as it stands on the branch. Err records a failure to read it, which must not be mistaken for the document being new: one means the repository is unreadable, the other that the document is editable.

type Change added in v0.6.0

type Change struct {
	Release string
	Summary string
}

Change is a release that changed what a rule reports.

type Context

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

Context is everything a rule needs.

Its fields are unexported and NewContext is the only way to fill them. That is deliberate: the branch snapshot is what Frozen reads, and a Context built as a literal without it reported every document as editable, which made the same document an error from one command and a warning from another. A rule stating "use the constructor" in a comment was not enough, so the compiler states it instead.

func NewContext

func NewContext(r *repo.Repo, g git.Repository, now time.Time) Context

NewContext builds a Context with the branch snapshot populated. Any caller whose rules depend on whether a document is frozen must use this rather than building a Context literal: Branch is what Frozen reads, and a Context without it reports every document as editable.

func (Context) BranchError added in v0.6.0

func (c Context) BranchError() error

BranchError is what kept the configured branch from being read, or nil when it was read or there is none. Frozen answers false for a document it could not read, which lint can afford, because L11 reports the failure, and a command about to edit cannot, so a writer refuses while this is set.

func (Context) Frozen

func (c Context) Frozen(d *repo.Document) bool

Frozen reports whether a document has already reached the branch in a terminal status, and so can no longer be edited. A finding only an edit to it could clear is a warning there, because L11 forbids the fix.

func (Context) Git

func (c Context) Git() git.Repository

Git is the repository's git, or nil when there is not one.

func (Context) Now

func (c Context) Now() time.Time

Now is the date the rules compare against.

func (Context) OnBranch

func (c Context) OnBranch(path string) (BranchFile, bool)

OnBranch is a document as it stands on the configured branch. ok is false when it is new there, or when there is no branch to compare against.

func (Context) Repo

func (c Context) Repo() *repo.Repo

Repo is the repository being checked.

func (Context) WithBase added in v0.6.0

func (c Context) WithBase(b *changes.Base) Context

WithBase returns the context with the record on the configured branch, which makes Run apply the merge rules.

type Finding

type Finding struct {
	// Path is relative to root.
	Path string
	// Line is 1-based, or 0 when the finding has no single line.
	Line     int
	Severity Severity
	Message  string
	Rule     string
}

Finding is one rule's complaint about one place.

func L01

func L01(ctx Context) []Finding

L01 checks that front matter parses and matches the schema for the type.

func L02

func L02(ctx Context) []Finding

L02 checks that the identifier matches the type and filename, and that the filename has the required shape.

func L03

func L03(ctx Context) []Finding

L03 checks that no identifier appears on more than one document.

func L04

func L04(ctx Context) []Finding

L04 checks that every reference resolves to an existing document of a type the field permits, and that every member of a group resolves and is listed once.

func L05

func L05(ctx Context) []Finding

L05 checks updates and obsoletes: same type, accepted, not the document itself, and not both at once.

func L06

func L06(ctx Context) []Finding

L06 checks that a spec page includes only accepted documents.

func L07

func L07(ctx Context) []Finding

L07 checks decided against the status and the created date, and a ref's as_of against its verified date.

func L08

func L08(ctx Context) []Finding

L08 checks that the required sections are present, correctly titled and in the required relative order, and that Rejection rationale is present exactly when the document is rejected.

func L09

func L09(ctx Context) []Finding

L09 checks that an accepted document leaves no open questions. Keyed on the section being present rather than on the document type, so it still holds if an ADR carries one as an extra section.

func L10

func L10(ctx Context) []Finding

L10 checks the H1 against the front matter.

func L11

func L11(ctx Context) []Finding

L11 checks that a frozen document is unchanged. A document is frozen once it has reached the branch in a terminal status; until then the working tree may differ freely, which is what makes the freezing commit legal.

func L12

func L12(ctx Context) []Finding

L12 checks that a spec page includes nothing that is effectively obsolete. Obsolescence claimed by a document that is not accepted has no effect, so a page is stale only once the replacement has actually been decided.

func L13

func L13(ctx Context) []Finding

L13 checks that a ref has been verified recently enough. A ref_stale_days of zero disables the rule, and a record of an exchange, a ref carrying as_of, is never reported: what was said on a date does not go out of date.

func L14

func L14(ctx Context) []Finding

L14 checks that no required section was left empty. It does not apply to withdrawn documents, whose sections are empty by the nature of abandonment. Open questions and Changelog, which are legitimately empty, are not required, so nothing here exempts them.

func L15

func L15(ctx Context) []Finding

L15 checks that each term gives exactly one paragraph.

Three of this rule's clauses existed only because every term shared one page: uniqueness, alphabetical order, and that every heading from the first entry onwards had to be an entry. A term is a file now, so uniqueness is the filesystem's answer, order is decided by generation, and a heading that is not a term is simply part of a definition.

func L16

func L16(ctx Context) []Finding

L16 checks that no [[...]] wiki link is left unexpanded.

func L17

func L17(ctx Context) []Finding

L17 checks that every relative link resolves to a file, and to a heading when it carries an anchor.

func L18

func L18(ctx Context) []Finding

L18 checks that a document does not rest on something less settled than itself. Two proposed documents may depend on one another, but an accepted document resting on a draft is suspicious.

func L19 added in v0.5.0

func L19(ctx Context) []Finding

L19 reports a glossary page left behind by a repository scaffolded before terms became files. A warning rather than an error: the page is valid Markdown and the repository is otherwise sound. Saying nothing would let an upgrade keep a page of terms that are no longer terms, with every [[...]] quietly ceasing to resolve and nothing pointing at why.

func L20 added in v0.6.0

func L20(ctx Context) []Finding

L20 checks the shape of the question sections: each question a level three heading, and each resolved one ending on a blockquote holding its answer. An accepted document's Open questions is L09's, which reports it holding anything at all, and a withdrawn document is abandoned and never checked.

func L21 added in v0.6.0

func L21(ctx Context) []Finding

L21 checks the Changelog: every entry a dated list item in the subset of list syntax the tool reads as CommonMark does, in order, and within the document's own dates. A withdrawn document is abandoned and never checked.

func L23 added in v0.6.0

func L23(ctx Context) []Finding

L23 reports a body too long to read. goldmark reads some shapes in time growing with the square of their length, so a body past repo.MaxBody is not read at all, and the rules that read a body pass the document over.

func M01 added in v0.6.0

func M01(ctx Context) []Finding

M01 reports an RFC or ADR arriving as a draft. A pull request is where a document is offered for comment, so what it lands has been proposed.

func M02 added in v0.6.0

func M02(ctx Context) []Finding

M02 names which of two documents sharing an identifier to renumber: the one arriving, since the other already holds the number on the base. L03 reports both without saying which.

func M03 added in v0.6.0

func M03(ctx Context) []Finding

M03 reports a change of status the lifecycle does not permit from the status on the base, under the base's strict.

func M04 added in v0.6.0

func M04(ctx Context) []Finding

M04 reports an RFC or ADR proposed on the base that the working tree no longer holds under its identifier: deleted, or renumbered. A proposed document no longer wanted is withdrawn, so that its number stays taken. A draft may be deleted, and a terminal document's deletion is L11's.

func Run

func Run(ctx Context) []Finding

Run applies every rule and returns the findings, ordered by path, then line, then rule, so that output is stable between runs.

type Rule

type Rule struct {
	Code  string
	Check func(Context) []Finding
	// Title names what the rule checks in a few words.
	Title string
	// Summary says what a finding means, and Remedy how one is cleared, both
	// as inline Markdown.
	Summary string
	Remedy  string
	// Since is the tag of the first release carrying the rule, and Changes the
	// later releases that changed what it reports, in release order.
	Since   string
	Changes []Change
}

Rule is one check, identified by the code it reports under, with what the reference publishes about it and the triage guide's table is generated from.

func (Rule) Merge added in v0.6.0

func (r Rule) Merge() bool

Merge reports whether a rule judges a pull request against its base, which Run applies only to a context carrying one. Their codes start with M.

type Severity

type Severity string

Severity is how much a finding matters. A finding that only an edit to a frozen document could clear is a warning, because L11 forbids that edit.

const (
	Error   Severity = "error"
	Warning Severity = "warning"
)

Jump to

Keyboard shortcuts

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