pub struct Policy {
pub severities: Vec<(String, Severity)>,
pub skips: Vec<String>,
pub settings: BTreeMap<String, String>,
}Expand description
What a trusted manifest’s policy lines add up to.
Fields§
§severities: Vec<(String, Severity)>(target, severity) in file order — later lines overwrite earlier
ones at fold time, matching git config’s own precedence rule.
skips: Vec<String>Skip targets, resolved by the same three-way naming hook.skip uses.
settings: BTreeMap<String, String>Committed defaults for allowlisted config keys, by FULL git key
(amont.timeout). Values are raw strings — GIT parses them at read
time (config::typed_literal), so no second config dialect exists.
Implementations§
Source§impl Policy
impl Policy
pub fn is_empty(&self) -> bool
Sourcepub fn from_lines(lines: &[Line]) -> (Policy, Vec<String>)
pub fn from_lines(lines: &[Line]) -> (Policy, Vec<String>)
Collect the policy from parsed lines, and say which targets name
nothing — validated here, over the WHOLE file, because parse_line
sees only earlier lines and a severity smoke warn written above its
own pre-commit smoke … declaration would be wrongly refused.
The naming universe is built-ins plus the file’s CHECK lines only
(Line::is_check) — a tool ruff … pin must not make
severity ruff warn look valid, and Broken lines count because a
broken line still produces a check id that hook.skip can reach.
An unmatched target is a NOTE, not a Line::Broken — a broken line
manufactures a check named after itself, and a phantom
pre-commit-clipy helps nobody.