pub struct Rule {
pub id: String,
pub query_str: String,
pub severity: Severity,
pub message: String,
pub allow: Vec<Pattern>,
pub source_path: PathBuf,
pub languages: Vec<String>,
pub enabled: bool,
pub builtin: bool,
pub requires: HashMap<String, String>,
pub fix: Option<String>,
}Expand description
A syntax rule definition.
Fields§
§id: StringUnique identifier for this rule.
query_str: StringThe tree-sitter query pattern.
severity: SeveritySeverity level.
message: StringMessage to display when the rule matches.
allow: Vec<Pattern>Glob patterns for files where matches are allowed.
source_path: PathBufSource file path of this rule (empty for builtins).
languages: Vec<String>Languages this rule applies to (inferred from query or explicit).
enabled: boolWhether this rule is enabled.
builtin: boolWhether this is a builtin rule.
requires: HashMap<String, String>Conditions that must be met for this rule to apply. Format: { “namespace.key” = “value” } or { “namespace.key” = “>=value” }
fix: Option<String>Auto-fix template using capture names from the query.
Use $capture_name to reference captures, $match for the full match.
Empty string means “delete the match”.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Rule
impl RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl UnwindSafe for Rule
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
Mutably borrows from an owned value. Read more
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>
Wrap the input message
T in a tonic::Request