pub struct RuleSpec {
pub index: usize,
pub id: RuleId,
pub languages: Vec<String>,
pub severity: Severity,
pub card: RuleCard,
pub query: String,
pub gates: Gates,
pub timeout: Option<Duration>,
pub has_reduce: bool,
}Expand description
A rule as the config declares it.
Fields§
§index: usizeZero-based position in the config’s rules array.
This is how the engine reaches the handler: the rule object lives in the loaded config, and indexing into it is what lets a function cross the boundary without ever being extracted as a value.
id: RuleIdNamespaced identifier.
languages: Vec<String>Which languages’ grammars the query compiles against, and which files the rule runs on.
A rule runs on a file only when the file’s own language is one of these, and it is
then parsed with that grammar. Running every rule against every file with a single
declared grammar is what used to turn a .tsx file into a tree of ERROR nodes —
silently, since a query simply matches nothing inside one.
severity: SeveritySeverity as the rule declares it, before config overrides.
card: RuleCardThe rule card.
query: StringThe tree-sitter query gating the handler.
gates: GatesPre-parse gates.
timeout: Option<Duration>A per-invocation budget overriding the default.
has_reduce: boolWhether the rule has a reduce phase.
Trait Implementations§
impl Eq for RuleSpec
impl StructuralPartialEq for RuleSpec
Auto Trait Implementations§
impl Freeze for RuleSpec
impl RefUnwindSafe for RuleSpec
impl Send for RuleSpec
impl Sync for RuleSpec
impl Unpin for RuleSpec
impl UnsafeUnpin for RuleSpec
impl UnwindSafe for RuleSpec
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.