Documentation
¶
Overview ¶
Package markup reports a prose document written in a markup dialect other than markdown.
Prose in these repositories is markdown, and only markdown. A reStructuredText or AsciiDoc document is not a document to be parsed differently — it IS the violation, because a second prose dialect splits every convention that follows from the first: what a heading is, what a link is, what the docs site renders, what a reviewer can read without switching tools. So this rule is about EXISTENCE, and its whole decision is the file's name.
THIS RULE IS PREVENTIVE ¶
It detects nothing today, and it exists to keep it that way. Measured over the fleet on 2026-08-12 — every file under ~/src/github.com carrying one of the banned suffixes, excluding the off-limits account — there are exactly three, all reStructuredText inside Python `.venv/site-packages` trees, all third-party, and all already invisible to this rule because the discovery prunes those trees. First-party instances: ZERO.
Re-measured 2026-08-12 after the shared walk began reporting the directory links it declines to enter: over the same 716 repositories, the whole fleet produces ONE diagnostic, and it is not a document. It is a blind-spot notice for `tsvsheet/_projects/.obsidian/plugins/tsvsheet`, a link to a tree outside the repository, in a repository whose `.gitignore` is a deny-all allowlist — the shape where the shared discovery deliberately stops honouring the filter rather than answer a whole run with a silent clean pass. Banned documents found: still ZERO.
The standard this fleet is written to says to measure before mechanizing, because an analyzer for a rule nobody breaks costs runtime forever and detects nothing. This one is built anyway, deliberately, on two grounds:
- Its cost is a map lookup on a file extension during a directory walk. It opens nothing, reads nothing and parses nothing, so the runtime it costs forever is a hash of a four-byte string per file the walk was already visiting.
- The pressure is live rather than hypothetical. The fleet contains Python subprojects — `sqlrest/sqlid/py`, `uplang/up.py` — and reStructuredText is the historical default for a PyPI long description, arriving with whatever `README.rst` a project template writes. The zero above is a state to hold, not a fact to celebrate.
Do not read that measurement as more than it says: this rule has never fired on a file anyone here wrote.
NO PARSER, NO CONTENTS ¶
The decision is the path, so nothing in this module opens a file. That is not an economy, it is the rule's shape: a `README.rst` holding zero bytes, holding invalid UTF-8, or holding eight megabytes of legal text is equally a reStructuredText document in a repository whose prose is markdown.
The size bound and the UTF-8 guard the sibling analyzers carry are therefore absent DELIBERATELY, not by omission. goyze.BoundedRead and goyze.ErrTooLarge exist for a rule that must read to decide; a rule that never reads cannot exceed a read bound, and declaring a sentinel nothing can return would be a contract with no behavior behind it. The shared discovery this analyzer walks with requires neither — its goyze.Claim may open a file and this one does not.
THE WAY OUT ¶
A repository that genuinely must ship one of these formats takes the route every other rule in this suite takes: the runner's per-repo exemption machinery, keyed on this analyzer's flat rule id (Rule) — a `.standards.yaml` entry carrying a stated reason, or a `.stickler.yaml` soft entry and baseline. Both are committed, reviewable, and ratcheted.
This analyzer adds no way out of its own: no in-file marker, no magic comment, no per-directory dotfile, because a second way out is a second answer to "is this repository exempt" and the two drift. What it does NOT claim is that no other way out exists — the shared walk's tree rules are one, and an adversarial review demonstrated the sharpest of them: an EMPTY FILE named `.git` makes the walk treat a directory as a nested checkout and skip it entirely, while git itself never reports a path of that name in `status`, `ls-files` or `--ignored`. That is an unauditable exemption, it belongs to `go-yze`'s discovery rather than to this rule, and it is written down here so nobody reads the paragraph above as a guarantee it is not.
Index ¶
Constants ¶
const Category = "docs"
Category is the language group this analyzer belongs to, used by the yze suite to run it only when processing documentation.
const ErrNoPaths errs.Const = "no paths to analyze"
ErrNoPaths reports a run given nothing to analyze. A runner whose root placeholder expands to nothing would otherwise green the gate over a repository no analyzer ever looked at — indistinguishable, at the exit code, from one it read and found clean.
const Name = "markup"
Name is the analyzer's stable identifier — the suffix of its flat rule id and the key the yze suite catalogs it under.
const Rule = Tool + "/" + Name
Rule is the stable, flat rule id every diagnostic carries: "yze/" + Name. It is what a runner softens, baselines, attributes and exempts on, which is why this rule needs no opt-out of its own.
const Tool = "yze"
Tool is the suite name stamped on every diagnostic.
Variables ¶
This section is empty.
Functions ¶
func Banned ¶
Banned reports a path this rule convicts, by its name alone. It is the analyzer's whole decision, exported because the command's discovery claims files with it — one predicate, so the walk and the report cannot disagree about what is banned.
func Diagnostics ¶ added in v0.2.0
func Diagnostics(at Path) ([]goyze.Diagnostic, error)
Diagnostics is the findings for one document, and is the entry point the yze suite drives this rule through.
It takes no source, and that is the rule's defining property rather than an omission: the decision is the NAME. A README.rst the gate could not open is as certainly a reStructuredText document as one it could, so there is nothing in the bytes for this rule to read. A rule that had to read to decide would have to report an unopenable path as an unknown; this one already knows.
Pair it with Banned as the claim predicate. Claiming only what can be convicted is what keeps the suite from reading every file in a repository to ask a question about its name — and, because the runner reads a claimed file before analysing it, what keeps one unreadable file from failing a whole run.
func Report ¶
Report is the whole run's report: every NAME the walk saw, and the paths it could not look inside.
It reads goyze.Expansion.Names and never goyze.Expansion.Files, which is this rule's shape rather than a preference. Files is one spelling per FILE — the right question for a rule that reads bytes, where analyzing one inode twice under two names reports one defect as two — and the wrong one here, because a name finding's subject IS the name. A `guide.adoc` symlink and a `notes.adoc` hard link are each a banned document in a repository under their own name; collapsing them to one reported spelling leaves the other in place with the gate green, and a symlink survives a clone as mode 120000. Reading BOTH lists is the other way to be wrong: Names is a superset of Files, so every file would be reported twice.
goyze.Expansion.Unreadable means something narrower here than the walk hands back, and the caller narrows it. A rule that must READ to decide is blind to every path it could not open; this rule decides by NAME, so a path the walk merely failed to read has still been seen and belongs with the names. What is left — a directory nobody could enumerate, whose children's names were never seen — is the only genuine blind spot, and it is what this list must carry.
It takes the expansion WHOLE, rather than a list of names and a list of failures, so both go through ONE counter, ONE limit and ONE truncation notice. Split across two entry points they disagreed in the sibling this rule was modelled on: read failures were appended past a limit that had already been applied to the findings, and a tree holding ten thousand unreadable files and one real violation reported the ten thousand, dropped the one, announced nothing and exited zero.