pub struct RuleOverride {
pub severity: Option<String>,
pub enabled: Option<bool>,
pub allow: Vec<String>,
pub tags: Vec<String>,
pub extra: HashMap<String, Value>,
}Expand description
Common per-rule configuration fields shared across all rule engines.
Used under [rules.rule."rule-id"] in .normalize/config.toml. These fields
apply to every rule regardless of engine. Rule-specific configuration
(e.g. thresholds, filenames) is defined as typed structs owned by each
rule and deserialized from the same TOML table via #[serde(flatten)].
Fields§
§severity: Option<String>Override the rule’s severity (error, warning, info, hint).
enabled: Option<bool>Enable or disable the rule.
allow: Vec<String>Additional file patterns to allow (skip) for this rule.
Additional tags to add to this rule (appends to built-in tags).
extra: HashMap<String, Value>Raw TOML table for rule-specific fields. Each rule deserializes its
own typed config from this via RuleOverride::rule_config.
Implementations§
Source§impl RuleOverride
impl RuleOverride
Sourcepub fn rule_config<T: DeserializeOwned + Default>(&self) -> T
pub fn rule_config<T: DeserializeOwned + Default>(&self) -> T
Deserialize rule-specific config from the extra fields.
Each rule defines a typed config struct and calls this to extract it.
Unknown fields in extra that don’t match T’s fields are ignored.
#[derive(Deserialize, Default)]
struct LargeFileConfig { threshold: Option<u64> }
let cfg: LargeFileConfig = override_.rule_config();
let threshold = cfg.threshold.unwrap_or(500);Trait Implementations§
Source§impl Clone for RuleOverride
impl Clone for RuleOverride
Source§fn clone(&self) -> RuleOverride
fn clone(&self) -> RuleOverride
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RuleOverride
impl Debug for RuleOverride
Source§impl Default for RuleOverride
impl Default for RuleOverride
Source§fn default() -> RuleOverride
fn default() -> RuleOverride
Source§impl<'de> Deserialize<'de> for RuleOverridewhere
RuleOverride: Default,
impl<'de> Deserialize<'de> for RuleOverridewhere
RuleOverride: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for RuleOverride
impl JsonSchema for RuleOverride
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Merge for RuleOverride
impl Merge for RuleOverride
Source§fn merge(self, other: Self) -> Self
fn merge(self, other: Self) -> Self
Merge two RuleOverride values, with other taking priority.
Optionfields:other’s value wins ifSome; falls back toself.- Vec fields (
allow,tags): ifother’s field is non-empty it replacesself’s field entirely; an emptyotherfield inherits fromself. extraHashMap: merged key-by-key,other’s keys overrideself’s.