pub struct RuleRunner { /* private fields */ }Expand description
Parallel rule execution engine.
The runner holds a collection of rules and executes them in parallel
against each query using rayon. It supports rule filtering via
configuration and severity overrides.
§Example
use sql_query_analyzer::{
config::RulesConfig,
query::{SqlDialect, parse_queries},
rules::RuleRunner
};
let config = RulesConfig {
disabled: vec!["STYLE001".into()],
..Default::default()
};
let runner = RuleRunner::with_config(config);
let queries = parse_queries("SELECT id FROM users", SqlDialect::Generic).unwrap();
let report = runner.analyze(&queries);
assert_eq!(report.error_count(), 0);Implementations§
Source§impl RuleRunner
impl RuleRunner
Sourcepub fn with_config(config: RulesConfig) -> Self
pub fn with_config(config: RulesConfig) -> Self
Create a new runner with configuration
§Notes
- Performance rules (PERF001-PERF020) detect query optimization issues
- Style rules (STYLE001-STYLE004) enforce best practices
- Security rules (SEC001-SEC008) detect dangerous operations
Sourcepub fn with_schema_and_config(schema: Schema, config: RulesConfig) -> Self
pub fn with_schema_and_config(schema: Schema, config: RulesConfig) -> Self
Create runner with schema-aware rules and configuration
§Notes
- Adds schema-aware rules (SCHEMA001-SCHEMA004) if not disabled
- Updates severity cache for schema rules
Sourcepub fn analyze(&self, queries: &[Query]) -> AnalysisReport
pub fn analyze(&self, queries: &[Query]) -> AnalysisReport
Run all rules on the provided queries (parallel execution)
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for RuleRunner
impl !UnwindSafe for RuleRunner
impl Freeze for RuleRunner
impl Send for RuleRunner
impl Sync for RuleRunner
impl Unpin for RuleRunner
impl UnsafeUnpin for RuleRunner
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more