pub struct Overrides(/* private fields */);Expand description
Every severity override visible here, resolved the way --get resolves it.
ONE subprocess for the whole stage, and — more importantly — a VALUE. The
dispatcher used to call severity_of inside the loop that classifies
outcomes, which put a git spawn in the middle of a fold and made the fold
impossible to test without a repository.
--get-regexp emits entries in precedence order, so folding with overwrite
lands on the same answer --get gives. That equivalence is not assumed:
the_batch_agrees_with_the_authority pins it against effective_override.
Implementations§
Source§impl Overrides
impl Overrides
Sourcepub fn read() -> Overrides
pub fn read() -> Overrides
Machine config AND the installed repo policy, folded on the
specificity ladder: system < global < POLICY < local < worktree <
command. --show-scope labels each config line; on a git too old to
know the flag (exit 129 → None) this degrades, deliberately, to
“ALL git config beats policy” — the fail-safe direction, because the
alternative was an EMPTY override set silently discarding both.
Sourcepub fn from_scoped(scoped: &str, policy: &Policy) -> Overrides
pub fn from_scoped(scoped: &str, policy: &Policy) -> Overrides
Fold --show-scope output around the installed policy. Scope words
system/global fold BELOW policy; everything else — local,
worktree, command, and any word a future git invents — folds
ABOVE, because misreading a local as below would let a file pulled
from a remote silently override a person’s explicit setting on their
own machine, and that is the worse direction to fail in.
Sourcepub fn from_plain_with_policy_below(
plain: Option<String>,
policy: &Policy,
) -> Overrides
pub fn from_plain_with_policy_below( plain: Option<String>, policy: &Policy, ) -> Overrides
The DEGRADED fold — policy below every config scope, i.e. all git
config beats policy — for a git that cannot label scopes. pub
because the fleet’s severity column must degrade the same way the
dispatcher does, not invent a third opinion.
Sourcepub fn from_config(out: Option<String>) -> Overrides
pub fn from_config(out: Option<String>) -> Overrides
Built from --get-regexp-shaped text (amont.severity.<check> <value> per line, in git’s own precedence order — system, then
global, then local, then includes). pub so a reader that has
already fetched those lines for its own reasons (the fleet dashboard
needs the origin of each, which Overrides does not track) can still
ask this — the one place that must not get precedence wrong — rather
than re-deriving it from the lines by hand.
Sourcepub fn applied_to(&self, check: &str) -> Option<(&str, Severity)>
pub fn applied_to(&self, check: &str) -> Option<(&str, Severity)>
The configured key that applies to check, and what it says.
Several keys can name one check — pre-commit and clippy and
pre-commit-clippy all reach pre-commit-clippy. The most specific
wins, which is the rule anybody would guess and the only one that lets
you downgrade a whole trigger and then exempt one check from it.