pub struct RuleStore { /* private fields */ }Expand description
Storage for pattern-based lint rules
Rules are loaded from three sources with priority:
- Project rules (highest priority)
- Global rules
- Builtin rules (lowest priority)
When searching by ID, project rules shadow global rules, which shadow builtin rules.
Implementations§
Source§impl RuleStore
impl RuleStore
Sourcepub const GLOBAL_RULES_DIR: &'static str = "rules/custom"
pub const GLOBAL_RULES_DIR: &'static str = "rules/custom"
Global rules directory relative to ~/.ryo/
Sourcepub const PROJECT_RULES_DIR: &'static str = ".ryo/rules"
pub const PROJECT_RULES_DIR: &'static str = ".ryo/rules"
Project rules directory relative to project root
Sourcepub fn load(project_path: &Path) -> Result<Self, RuleStoreError>
pub fn load(project_path: &Path) -> Result<Self, RuleStoreError>
Sourcepub fn builtin_only() -> Result<Self, RuleStoreError>
pub fn builtin_only() -> Result<Self, RuleStoreError>
Load only builtin rules (for minimal setup)
Sourcepub fn all_rules(&self) -> impl Iterator<Item = &Rule>
pub fn all_rules(&self) -> impl Iterator<Item = &Rule>
Iterate all rules (builtin → global → project order)
Later rules can override earlier ones with the same ID.
Use find_by_id for priority-aware lookup.
Sourcepub fn rules_by_scope(&self, scope: RuleScope) -> &[Rule]
pub fn rules_by_scope(&self, scope: RuleScope) -> &[Rule]
Get rules by scope
Sourcepub fn find_by_id(&self, id: &str) -> Option<&Rule>
pub fn find_by_id(&self, id: &str) -> Option<&Rule>
Find rule by ID (project > global > builtin priority)
Sourcepub fn count_by_scope(&self, scope: RuleScope) -> usize
pub fn count_by_scope(&self, scope: RuleScope) -> usize
Get rule count by scope
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RuleStore
impl RefUnwindSafe for RuleStore
impl Send for RuleStore
impl Sync for RuleStore
impl Unpin for RuleStore
impl UnsafeUnpin for RuleStore
impl UnwindSafe for RuleStore
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