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_strict_secrets(self, strict: bool) -> Self
pub fn with_strict_secrets(self, strict: bool) -> Self
Enables or disables strict secrets mode. When enabled, dummy key heuristics are disabled for test files.
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 strict_secrets(&self) -> bool
pub fn strict_secrets(&self) -> bool
Returns whether strict_secrets is enabled.
Sourcepub fn engine(&self) -> &RuleEngine
pub fn engine(&self) -> &RuleEngine
Returns a reference to the underlying RuleEngine.