pub struct External {
pub id: String,
pub short_name: String,
pub stage: Stage,
pub kind: Kind,
pub lineno: Option<usize>,
}Expand description
A check a repository declares, rather than one compiled in.
Fields§
§id: String<trigger>-<name> — what hook.skip and amont.severity.<key>
resolve against, and what Check::name returns. Built-ins have had this
shape all along; declared checks answering to a bare name were invisible
to hook.skip pre-commit.
short_name: StringThe name as written in the manifest — the “short name” of the vocabulary
— used for messages. A line too malformed to name itself falls back to
its position, and reading pre-commit-amont.conf:3 back to somebody
helps nobody.
stage: Stage§kind: Kind§lineno: Option<usize>The 1-based line of the manifest that declares it, None for a line
that carries no position: what a message names when it sends a person
to the line to edit.
Implementations§
Source§impl External
impl External
Sourcepub fn effective_scope(&self) -> Scope
pub fn effective_scope(&self) -> Scope
The scope this declaration fires on and is judged on: its resolved
trigger when it has one (its own scope united with its push twin’s),
else the scope as written. Scope::ALWAYS for an unusable one.
Sourcepub fn blocks_at_commit(&self, severities: &Overrides, skips: &[String]) -> bool
pub fn blocks_at_commit(&self, severities: &Overrides, skips: &[String]) -> bool
Whether this is a commit-time declaration that blocks and is not
switched off: the ones whose runs earn stamps. The ONE predicate
blocking_commit_decls and Manifest::resolve_triggers share, so the
two cannot disagree about which declarations count, and it lives on the
type it judges, not in a hook that depends on this module.
Sourcepub fn manifest_severity(&self) -> Option<Severity>
pub fn manifest_severity(&self) -> Option<Severity>
What the amont.conf line declares, trusted or not: reading the file
applies nothing, so a reader may be told what it says. None for a
line that did not parse.
Trait Implementations§
Source§impl Check for External
impl Check for External
Source§fn scope(&self) -> Scope
fn scope(&self) -> Scope
Derived for an unusable check rather than stored: it never runs, so its scope is a question with no answer, and computing one here keeps the DATA from carrying a value that means nothing.
Source§fn weight(&self) -> Weight
fn weight(&self) -> Weight
Heavy when the line says heavy, or when it MOVES a built-in Heavy
gate: pre-commit cargo-test runs the suite pre-push-cargo-test
would, and must queue as that gate does (ADR-0013).
fn name(&self) -> &str
fn stage(&self) -> Stage
fn severity(&self) -> Severity
fn run(&self, ctx: &Ctx<'_>) -> Outcome
Source§fn pairing_name(&self) -> &str
fn pairing_name(&self) -> &str
Source§fn reach(&self) -> Reach
fn reach(&self) -> Reach
amont.conventions is declared —
see Reach. Externals default to Convention, which costs them
nothing: a declared check only exists where an amont.conf does,
and that is exactly the declaration the mode asks for.Source§fn would_judge(&self, staged: &[String], tracked: Option<&[String]>) -> bool
fn would_judge(&self, staged: &[String], tracked: Option<&[String]>) -> bool
Skipped when this says yes
and Inert when it says no (ADR-0020). tracked: None (git would not
list the index) answers yes: a skip is said, never hidden.