Skip to main content

RuleEngine

Struct RuleEngine 

Source
pub struct RuleEngine { /* private fields */ }
Expand description

Rule execution engine

Implementations§

Source§

impl RuleEngine

Source

pub fn new() -> Self

Create a new engine with default settings

Source

pub fn from_config(config: LintConfig) -> Self

Create from a lint configuration

Source

pub fn add_rule(&mut self, rule: Rule)

Add a rule

Source

pub fn add_rules(&mut self, rules: impl IntoIterator<Item = Rule>)

Add multiple rules

Source

pub fn set_severity_threshold(&mut self, threshold: Severity)

Set severity threshold

Source

pub fn active_rules(&self) -> impl Iterator<Item = &Rule>

Get all active rules (respecting overrides)

Source

pub fn effective_severity(&self, rule: &Rule) -> Severity

Get effective severity for a rule (considering overrides)

Source

pub fn execute_rule(&self, _rule: &Rule) -> Vec<MatchResult>

Execute a rule and produce a MatchResult

Note: This is a placeholder that needs integration with ryo-analysis for actual AST matching. Currently returns the match result structure.

Source

pub fn execute_all(&self) -> Vec<MatchResult>

Execute all active rules

Source

pub fn diagnostics_from_results<'a>( &self, results: impl IntoIterator<Item = &'a MatchResult>, file_path: impl AsRef<Path>, ) -> Vec<Diagnostic>

Produce diagnostics from match results

Source

pub fn process_result(&self, result: MatchResult, rule: &Rule) -> MatchResult

Process a MatchResult through message interpolation

Trait Implementations§

Source§

impl Default for RuleEngine

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.