pub struct ScannerConfig { /* private fields */ }Expand description
Common configuration shared by all scanners.
This struct provides a unified way to manage RuleEngine settings, ignore filters, and common file operations across different scanner implementations.
Implementations§
Source§impl ScannerConfig
impl ScannerConfig
Sourcepub fn with_skip_comments(self, skip: bool) -> Self
pub fn with_skip_comments(self, skip: bool) -> Self
Enables or disables comment skipping during scanning.
Sourcepub fn with_ignore_filter(self, filter: IgnoreFilter) -> Self
pub fn with_ignore_filter(self, filter: IgnoreFilter) -> Self
Sets an ignore filter for file filtering.
Sourcepub fn with_dynamic_rules(self, rules: Vec<DynamicRule>) -> Self
pub fn with_dynamic_rules(self, rules: Vec<DynamicRule>) -> Self
Adds dynamic rules loaded from custom YAML files.
Sourcepub fn is_ignored(&self, path: &Path) -> bool
pub fn is_ignored(&self, path: &Path) -> bool
Returns whether the given path should be ignored.
Sourcepub fn read_file(&self, path: &Path) -> Result<String>
pub fn read_file(&self, path: &Path) -> Result<String>
Reads a file and returns its content as a string.
Sourcepub fn check_content(&self, content: &str, file_path: &str) -> Vec<Finding>
pub fn check_content(&self, content: &str, file_path: &str) -> Vec<Finding>
Checks the content against all rules and returns findings.
Sourcepub fn check_frontmatter(
&self,
frontmatter: &str,
file_path: &str,
) -> Vec<Finding>
pub fn check_frontmatter( &self, frontmatter: &str, file_path: &str, ) -> Vec<Finding>
Checks YAML frontmatter for specific rules (e.g., OP-001).
Sourcepub fn skip_comments(&self) -> bool
pub fn skip_comments(&self) -> bool
Returns whether skip_comments is enabled.
Sourcepub fn engine(&self) -> &RuleEngine
pub fn engine(&self) -> &RuleEngine
Returns a reference to the underlying RuleEngine.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ScannerConfig
impl RefUnwindSafe for ScannerConfig
impl Send for ScannerConfig
impl Sync for ScannerConfig
impl Unpin for ScannerConfig
impl UnwindSafe for ScannerConfig
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