pub struct WindowPatternRule { /* private fields */ }Expand description
Enforces that when a trigger pattern appears, a required pattern must also appear within a configurable window of lines.
Example: “every UPDATE/DELETE query must have an organizationId within 80 lines” or “every async route handler must have try/catch within 10 lines”.
Config fields:
pattern— trigger pattern (literal or regex)condition_pattern— required pattern that must appear nearbymax_count— window size (number of lines to search after trigger)regex— whether patterns are regex
Implementations§
Source§impl WindowPatternRule
impl WindowPatternRule
pub fn new(config: &RuleConfig) -> Result<Self, RuleBuildError>
Trait Implementations§
Source§impl Debug for WindowPatternRule
impl Debug for WindowPatternRule
Source§impl Rule for WindowPatternRule
impl Rule for WindowPatternRule
Auto Trait Implementations§
impl Freeze for WindowPatternRule
impl RefUnwindSafe for WindowPatternRule
impl Send for WindowPatternRule
impl Sync for WindowPatternRule
impl Unpin for WindowPatternRule
impl UnsafeUnpin for WindowPatternRule
impl UnwindSafe for WindowPatternRule
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> 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