IF Commons GitHub

changes/commit-message

What a commit's message says of the change requests it serves (commons 0020-ifccm FR-005 to FR-008, FR-033): the lines Refs #N and Closes #N (or owner/repo#N for another repository), the words a Git host reads as closing an issue other than Closes, and the lines Departs: and Decision: that say a commit departs from a specification and which Decision authorizes it, and the line Impact: that says how much the change raises a version (major, minor or patch; commons 0026-works-versioning FR-021), which is read here so that a line that is none of the three can be found.

Pure text in, data out. A reference is read only from a line of its own: Closes #10 in the middle of a sentence is not read. The closing words a host reads (Fixes, Resolves, Closed, ...) are read wherever they stand, because the host reads them wherever they stand; the rule that reports them is rules.ts, never this module.

import { parseMessage } from "./commit-message.ts";
parseMessage("Add the check\n\nRefs #10\n").refs; // [{ kind: "refs", repo: undefined, number: 10, line: 3 }]

Source: commons/mizan/src/changes/commit-message.ts

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

changes.namedIssuesfunctionno test imports it
function namedIssues(m: ParsedMessage): readonly string[]

Every change request a message names, by a proper line or by a closing word, as owner/repo#N or #N, each once.

changes.parseMessagefunctionno test imports it
function parseMessage(message: string): ParsedMessage

A message's change requests, closing words, departures and Decisions. A line is read from its first non-space character; a quoted line (>) is not read.

changes.IssueReftypeno test imports it
type IssueRef = { readonly kind: ReferenceKind; readonly repo: string | undefined; readonly number: number; readonly line: number };

A change request a commit names on a line of its own: its kind, the repository (owner/repo) where it is another's, its number and the line of the message.

changes.ParsedMessagetypeno test imports it
type ParsedMessage = { /** The `Refs` and `Closes` lines, in order. */ readonly refs: readonly IssueRef[]; /** The… (620 characters)
type ParsedMessage = {
  /** The `Refs` and `Closes` lines, in order. */
  readonly refs: readonly IssueRef[];
  /** The closing words other than `Closes`, in order. */
  readonly wrongWords: readonly WrongWord[];
  /** The requirements (`NNNN-slug FR-nnn`) the `Departs:` lines name. */
  readonly departs: readonly string[];
  /** The identifiers the `Decision:` lines name. */
  readonly decisions: readonly string[];
  /** The `Impact:` lines whose value is not `major`, `minor` or `patch`: the value as written and the line. */
  readonly badImpacts: readonly { readonly value: string; readonly line: number }[];
};

A message as the check reads it.

changes.ReferenceKindtypeno test imports it
type ReferenceKind = "refs" | "closes";

How a line names a change request (ifccm:IssueReferenceKind): refs while the capability is in progress, closes on the commit that finishes it.

changes.WrongWordtypeno test imports it
type WrongWord = { readonly word: string; readonly repo: string | undefined; readonly number: number; readonly line: number };

A closing word a host reads that is not Closes: the word as written, the change request it names and the line.

namedIssuesfunction
function namedIssues(m: ParsedMessage): readonly string[]

Every change request a message names, by a proper line or by a closing word, as owner/repo#N or #N, each once.

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

parseMessagefunction
function parseMessage(message: string): ParsedMessage

A message's change requests, closing words, departures and Decisions. A line is read from its first non-space character; a quoted line (>) is not read.

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

IssueReftypeno test imports it
type IssueRef = { readonly kind: ReferenceKind; readonly repo: string | undefined; readonly number: number; readonly line: number };

A change request a commit names on a line of its own: its kind, the repository (owner/repo) where it is another's, its number and the line of the message.

ParsedMessagetypeno test imports it
type ParsedMessage = { /** The `Refs` and `Closes` lines, in order. */ readonly refs: readonly IssueRef[]; /** The… (620 characters)
type ParsedMessage = {
  /** The `Refs` and `Closes` lines, in order. */
  readonly refs: readonly IssueRef[];
  /** The closing words other than `Closes`, in order. */
  readonly wrongWords: readonly WrongWord[];
  /** The requirements (`NNNN-slug FR-nnn`) the `Departs:` lines name. */
  readonly departs: readonly string[];
  /** The identifiers the `Decision:` lines name. */
  readonly decisions: readonly string[];
  /** The `Impact:` lines whose value is not `major`, `minor` or `patch`: the value as written and the line. */
  readonly badImpacts: readonly { readonly value: string; readonly line: number }[];
};

A message as the check reads it.

ReferenceKindtypeno test imports it
type ReferenceKind = "refs" | "closes";

How a line names a change request (ifccm:IssueReferenceKind): refs while the capability is in progress, closes on the commit that finishes it.

WrongWordtypeno test imports it
type WrongWord = { readonly word: string; readonly repo: string | undefined; readonly number: number; readonly line: number };

A closing word a host reads that is not Closes: the word as written, the change request it names and the line.

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