IF Commons GitHub

versions/rules

The findings of the versions tool (commons 0026-works-versioning FR-007, FR-013, FR-020, FR-022, FR-027, FR-028): the rule each belongs to and the shape every one has.

Pure data. A finding names the file it is about (a record, or refs/tags/<tag> for a tag), the rule, a sentence, and the work. The rules that read only a folder (a record that does not decode, a version that does not match its scheme, a controlled document with no approval) are those of the rule plugin (plugin.ts); the others need Git and are the command's.

import { VERSIONS_RULES } from "./rules.ts";
VERSIONS_RULES.includes("versions/not-grown"); // true

Source: commons/mizan/src/versions/rules.ts

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

versions.formatFindingfunctionno test imports it
function formatFinding(f: VersionsFinding): string

A finding as one line: file: rule: message.

versions.sortFindingsfunctionno test imports it
function sortFindings(findings: readonly VersionsFinding[]): readonly VersionsFinding[]

Findings in a stable order: by file, then rule, then message.

versions.VERSIONS_RULESconstno test imports it
const VERSIONS_RULES: readonly VersionsRule[]

Every rule, in the order a report lists them.

versions.VersionsFindingtypeno test imports it
type VersionsFinding = {
  readonly rule: VersionsRule;
  readonly file: string;
  readonly work: string;
  readonly message: string;
};

A finding: the rule, the file (or tag) it is about, the work's slug where it is known and a sentence.

versions.VersionsRuletypeno test imports it
type VersionsRule =
  | "versions/record-invalid"
  | "versions/scheme-mismatch"
  | "versions/approval-missing"
  | "versions/identity-changed"
  | "versions/not-grown"
  | "versions/ledger-order"
  | "versions/tag-moved"
  | "versions/tag-removed"
  | "versions/retention-early";

The ids of the rules of the tool.

formatFindingfunctionno test imports it
function formatFinding(f: VersionsFinding): string

A finding as one line: file: rule: message.

sortFindingsfunctionno test imports it
function sortFindings(findings: readonly VersionsFinding[]): readonly VersionsFinding[]

Findings in a stable order: by file, then rule, then message.

VERSIONS_RULESconst
const VERSIONS_RULES: readonly VersionsRule[]

Every rule, in the order a report lists them.

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

VersionsFindingtypeno test imports it
type VersionsFinding = {
  readonly rule: VersionsRule;
  readonly file: string;
  readonly work: string;
  readonly message: string;
};

A finding: the rule, the file (or tag) it is about, the work's slug where it is known and a sentence.

VersionsRuletypeno test imports it
type VersionsRule =
  | "versions/record-invalid"
  | "versions/scheme-mismatch"
  | "versions/approval-missing"
  | "versions/identity-changed"
  | "versions/not-grown"
  | "versions/ledger-order"
  | "versions/tag-moved"
  | "versions/tag-removed"
  | "versions/retention-early";

The ids of the rules of the tool.

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