Documentation
¶
Overview ¶
Package mapcheck checks a product's map against its format and size limits: the rules `physa check map` enforces. It builds on the reader's problems and adds what each kind of entry must carry, that every folder keeps the folder format (index.md's grammar and links, each kind file's title, sections, headings, and contents that match its entries), that slugs and terms are unique, that document anchors name files in the repo, that commit anchors name changes in the repo's history, read through version control, and that each file stays within its limit.
Index ¶
Constants ¶
const ( MaxIndexLines = 30 MaxRulesLines = 150 )
The size limits of a folder's files (09 §6), the same for the product and every capability. Going over one fails the check; decisions.md and questions.md have none.
const ( PRAnchorsGitHub = "github" PRAnchorsFormOnly = "form-only" )
The values of Result.PRAnchors.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// PRExists tells whether a PR with this number exists. Nil checks #N
// anchors for form only. An error stops resolving for the rest of the
// run: PR anchors are then checked for form only.
PRExists func(n int) (bool, error)
// OpenRepo opens the version control holding root. It is called once,
// when the first commit anchor is met. Nil leaves commit anchors
// unresolved: each is a problem.
OpenRepo func(root string) (vcs.Repo, error)
// DocRoot is where `from <path>` anchors resolve; empty means root. A
// scratch copy of the map uses it to check against the real repo.
DocRoot string
// FormOnly checks every anchor for its form alone: a commit anchor is
// not resolved, so it is no problem, and a #N anchor is not resolved
// whatever PRExists says. History and the forge are never read. Every
// other check runs as it does without the option: format, contents,
// slugs, terms, size limits, and `from <path>` anchors naming a file.
FormOnly bool
}
Options carries what the check cannot learn from the repo's files.
type Result ¶
type Result struct {
Problems []mapfile.Problem // sorted by path, then line, then message
Capabilities int
Entries int // entries in the product and in every capability
// PRAnchors says how #N anchors were checked: PRAnchorsGitHub when every
// one was resolved, PRAnchorsFormOnly when only their form was.
PRAnchors string
// PRNote is why PR anchors were checked for form only after the resolver
// failed; empty otherwise (the caller explains a missing resolver).
PRNote string
}
Result is what a check found.
func Check ¶
Check reads the map under root (the repo root) and checks it, with no resolver for #N anchors and no version control for commit anchors. The error is only for a map that cannot be read at all.