IF Commons GitHub

levels

The conformance levels as the check reads them (commons 0028-conformance-levels): L0 registered, L1 core, L2 standards and L3 governed, which Mizan's ontology states as typed data (mz:ConformanceLevel, mz:ConformanceRequirement), and the rule of which of Mizan's rules a level runs.

Pure functions over the ontology's individuals. A level entails the requirements it adds and those of every level of a lower rank. A rule is run at a level when a requirement the level entails names it with mz:rule (an id, or a family such as changes/*); a rule that no requirement of any level names runs at L1 and above, and at L0 no rule runs. The default level of a harness is L3, which runs every rule, so that a harness that declares none sees what it saw before levels existed (FR-008).

import { levelOf, ruleRunsAt } from "./levels.ts";
ruleRunsAt("mizan/requirement-ears", "L1"); // true
ruleRunsAt("mizan/decision-missing", "L1"); // false: the audit of terms is L2
levelOf("L9"); // undefined

Source: commons/mizan/src/levels.ts

7 of 11 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

DEFAULT_LEVELconst
const DEFAULT_LEVEL: LevelKey

The level a harness is at where it declares none (0028-conformance-levels FR-008).

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

entailedByfunction
function entailedBy(level: LevelKey): readonly Entailed[]

The requirements a level entails: those it adds and those of every level below it, lowest level first.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

LEVELSconst
const LEVELS: readonly LevelKey[]

The four levels, lowest first.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

LevelKeytypeno test imports it
type LevelKey = "L0" | "L1" | "L2" | "L3";

The notation of a level: L and its rank.

levelOffunction
function levelOf(text: string): LevelKey | undefined

Text as a level, or undefined where it is not one of the four (L0 to L3).

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

ruleRunsAtfunction
function ruleRunsAt(rule: string, level: LevelKey): boolean

Whether the check runs a rule at a level (0028-conformance-levels FR-009): the rule is named by a requirement of that level or a lower one; a rule no requirement names runs at L1 and above, and at L0 none runs.

Imported by 17 tests of the run (17 passed, 0 failed): the library's results

DEFAULT_LIBRARY_LEVELconstno test imports it
const DEFAULT_LIBRARY_LEVEL: LevelKey

The level a library is at where its manifest declares none (0027-commons-libraries FR-012).

rankOffunctionno test imports it
function rankOf(level: LevelKey): number

The rank of a level: 0 to 3.

Entailedtypeno test imports it
type Entailed = {
  readonly key: string;
  readonly addedBy: LevelKey;
  readonly rules: readonly string[];
  readonly enforcedBy: readonly string[];
};

A requirement of a level and the level that adds it.

ruleMatchesfunction
function ruleMatches(pattern: string, rule: string): boolean

Whether a rule id is named by a pattern: the id itself, or a family prefix/*.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

levelOfRulefunction
function levelOfRule(rule: string): LevelKey | undefined

The lowest level whose requirements name the rule, or undefined where no requirement of any level does.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.