pub struct QueryRule {
pub name: &'static str,
pub languages: &'static [Language],
pub pattern: &'static str,
pub severity: Severity,
pub handler: Option<QueryHandler>,
pub skips_test_files: bool,
}Expand description
A tree-sitter query based rule definition.
This is the primary building block for tree-sitter rules.
Each rule specifies a query pattern (in tree-sitter query syntax),
the languages it applies to, and a handler that converts
query matches into CodeIssues.
Fields§
§name: &'static strUnique rule identifier (e.g. “single-letter-variable”).
languages: &'static [Language]Languages this rule applies to.
pattern: &'static strThe tree-sitter query pattern string. Uses standard tree-sitter query syntax with named captures.
severity: SeverityDefault severity when match is found.
handler: Option<QueryHandler>Custom handler to produce issues from a match. If None, a default handler is used (one issue per match at the capture node).
skips_test_files: boolWhether to skip test files.
Auto Trait Implementations§
impl Freeze for QueryRule
impl RefUnwindSafe for QueryRule
impl Send for QueryRule
impl Sync for QueryRule
impl Unpin for QueryRule
impl UnsafeUnpin for QueryRule
impl UnwindSafe for QueryRule
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