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>(&self) -> Twhere
T: DeserializeOwned + Default,
pub fn rule_config<T>(&self) -> Twhere
T: DeserializeOwned + Default,
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<RuleOverride, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RuleOverride, <__D as Deserializer<'de>>::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: RuleOverride) -> RuleOverride
fn merge(self, other: RuleOverride) -> RuleOverride
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.
Source§impl Serialize for RuleOverride
impl Serialize for RuleOverride
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for RuleOverride
impl RefUnwindSafe for RuleOverride
impl Send for RuleOverride
impl Sync for RuleOverride
impl Unpin for RuleOverride
impl UnsafeUnpin for RuleOverride
impl UnwindSafe for RuleOverride
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request