pub enum Severity {
Off,
Warn,
Error,
Fix,
}Expand description
Rule severity level. Configurable per rule in .marque.toml.
§Ordering
The derived Ord is Off < Warn < Error < Fix. The ordering is
exposed for consumers that want to compare severities (e.g.,
“is this at least Error?”) but the config loader does not use it
as a merge operator today.
§Merge semantics (current: last-write-wins)
marque-config merges layers in strict precedence order — env vars
override .marque.local.toml which overrides .marque.toml. Whatever
the highest-precedence layer says for a given rule wins, including
downgrades: a local override of "off" will suppress a project-config
"error". This is intentional — individual classifiers sometimes need
to silence a rule while iterating, and the audit log still records the
configured severity for every applied fix.
If a future policy requires strictness-only merging (where a lower
layer cannot downgrade a higher layer’s severity), change the loader
to .max() over Severity::parse_config values rather than extend.
The derived Ord above is already the correct operator for that case.
Variants§
Off
Rule is disabled entirely. FR-008: severity=off is unrepresentable on emitted diagnostics
— a rule at Off never fires, so no Diagnostic is produced.
Warn
Emit warning; do not block.
Error
Emit error; blocks --check exit code.
Fix
Apply fix automatically when --fix flag is present.
Implementations§
Source§impl Severity
impl Severity
Sourcepub fn parse_config(s: &str) -> Option<Self>
pub fn parse_config(s: &str) -> Option<Self>
Parse a severity level from a config string. Returns None for
unrecognized values; the config loader treats None as a hard error.
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
Canonical lowercase string form, suitable for JSON output.
This is the inverse of Severity::parse_config and is the stable
surface that JSON consumers should depend on — never format!("{:?}")
(which exposes Debug formatting as an unintended API).