Expand description
The judge: one commit message, against the policy, with every finding it earns.
§Why this exists at all
project.conventional-commits was a rule whose failure behaviour read “No command
decides this rule; a reviewer does”. That is a rule this repository states and cannot
check, which is the failure mode the whole governance layer exists to prevent — and the
parser that would have decided it was already here, reading the history for the
changelog. What was missing was not a grammar. It was a verdict.
§What it judges, and what it refuses to
The findings below are the ones a machine can decide from evidence that is present at the moment a commit is written: the grammar, the width, whether a scope is one this repository uses, whether a record the message names exists, whether a fix carries a test, whether a breaking change says why. It does not judge whether the subject is a good sentence, whether the change is atomic, or whether the work was worth doing; a reviewer decides those, and a validator that pretended to would be a validator nobody trusts.
use majordomus_cli::commit::{judge, CommitPolicy, CommitSubject};
use majordomus_cli::model::Severity;
let v = judge(&CommitSubject::of("update stuff"), &CommitPolicy::default());
assert!(!v.passed);
assert_eq!(v.findings[0].code, "commit.not_conventional");
// and git's own subjects are exempt rather than wrong
let m = judge(&CommitSubject::of("Merge pull request #249 from korczis/fix"), &CommitPolicy::default());
assert!(m.passed);
assert!(m.exempt.is_some());
let _ = Severity::Error;Structs§
- Commit
Subject - Everything the judge is allowed to look at.
- Commit
Verdict - What the judge concluded: the message as it was parsed, whether anything of error
severity was found, the exemption when git composed the subject rather than a person, and
every finding in
CommitRule::ALLorder — which is the order the evidence for them appears in the message, so a person reads them in the order they would fix them. - History
Report - A range of history, judged. A range of history, judged in one pass.
- Judged
Commit - One commit of the history, judged.
Enums§
- Commit
Exemption - Why a commit was not judged.
- Commit
Rule - Every code this module can produce, as one closed set.
Functions§
- judge
- Judge one commit.
Judge one commit against
policy. - without_
code_ spans - A record id inside a backticked code span is being shown, not cited: a message that
writes
I9999 — Gone from the modelis illustrating the shape of a reference, and the layer is not expected to hold it. Blanking the spans before the scan keeps a real citation in prose readable while an example stops being one.