The rules Mizan adds to the format of a specification (commons 0003-mizanFR-013 to FR-015, 0018-standards-firstFR-009, FR-016), as plugins: each reads the specifications of a folder and gives its findings as data, held against a baseline that only shrinks (kernel/trace.ts). A harness adds its own rules by passing more plugins.
Pure functions over text. A requirement is a bullet - **FR-nnn**: ... (and the indented lines under it); its wording is read for RFC 2119 keywords (MUST, MUST NOT, SHOULD, SHOULD NOT, MAY) and the EARS patterns: event-driven (WHEN <event>, ...), state-driven (WHILE <state>, ...), unwanted behaviour (IF <condition>, THEN ...), optional feature (WHERE <feature>, ...), a combination of them, and ubiquitous (none of these leads the sentence). An acceptance scenario is a line with Given, When and Then in that order that cites a requirement. A plan.md has a ## Standards considered section. A requirement that names a citation of the Code of Federal Regulations or the United States Code carries Authority: and the identifiers of the mz:Authority individuals that cover it (0018-standards-firstFR-015, FR-016).
import { earsPatternOf, mizanFindings } from"./rules.ts";
earsPatternOf("WHEN a file has no citation, the check MUST report it."); // "event"mizanFindings([{ slug: "0001-x", spec: "- **FR-001**: It works.\n" }]).map((f) => f.rule); // ["mizan/requirement-keyword"]
The rule that a requirement that comes from law cites its authority (0018-standards-firstFR-015, FR-016), for the authorities given: a requirement that names a citation of law and has no Authority: followed by identifiers is found, so is one that names an identifier of none of the authorities, and so is a citation of law that no authority it names covers.
An authority a requirement may name: the CURIE of its mz:Authority individual (mzid:authority-21-cfr-820) and the citation of the law (21 CFR Part 820).
The key a specification declares in its head with **Subject:** or **Audience:**, in lower case, and the line it is on; the first such line counts (0029-subject-profilesFR-002, FR-008).
The EARS pattern of a requirement's sentence, or undefined where a trigger leads it in a form EARS does not have (an IF with no THEN, a trigger with no comma).
A finding of one of Mizan's rules: the same shape as the trace's, with a rule that is Mizan's. A finding of the changes check (commons 0020-ifccm) also carries its phase: a gate finding fails whatever the baseline holds, a warn finding is held by it.
A specification lacks a section that the profile of its kind of subject or its audience asks for (0029-subject-profilesFR-011): none where it declares nothing, because a library asks for none.
A citation of law as the rule compares it: 21 CFR 820.30 for a section, 42 USC 1320d for the United States Code, however the text spaced or punctuated it.
The citations of the Code of Federal Regulations and the United States Code that a text names, in the order it names them (0018-standards-firstFR-015).