pub struct SuppressionEngine { /* private fields */ }Expand description
Engine for checking if findings should be suppressed
Consolidates all suppression logic:
- Global path ignores (rules.ignore_paths)
- Per-rule path ignores (rules.ignore_paths_by_rule)
- Inline suppressions (rma-ignore comments)
- Default test/example presets for PR/CI mode
- Baseline filtering
- Database suppressions (when enabled)
Implementations§
Source§impl SuppressionEngine
impl SuppressionEngine
Sourcepub fn new(rules_config: &RulesConfig, use_default_presets: bool) -> Self
pub fn new(rules_config: &RulesConfig, use_default_presets: bool) -> Self
Create a new suppression engine from config
Sourcepub fn with_defaults_only() -> Self
pub fn with_defaults_only() -> Self
Create a suppression engine with just default presets (no config)
Sourcepub fn with_baseline(self, baseline: Baseline) -> Self
pub fn with_baseline(self, baseline: Baseline) -> Self
Set the baseline for filtering
Sourcepub fn with_store(self, store: SuppressionStore) -> Self
pub fn with_store(self, store: SuppressionStore) -> Self
Set the suppression store for database-backed suppressions
Sourcepub fn with_store_ref(self, store: Arc<SuppressionStore>) -> Self
pub fn with_store_ref(self, store: Arc<SuppressionStore>) -> Self
Set a shared suppression store reference
Sourcepub fn store(&self) -> Option<&SuppressionStore>
pub fn store(&self) -> Option<&SuppressionStore>
Get a reference to the suppression store (if available)
Sourcepub fn with_skip_security_in_tests(self, skip: bool) -> Self
pub fn with_skip_security_in_tests(self, skip: bool) -> Self
Enable skipping security rules in test paths (–skip-tests-all)
Sourcepub fn is_always_enabled(rule_id: &str) -> bool
pub fn is_always_enabled(rule_id: &str) -> bool
Check if a rule is in the always-enabled list (security rules)
Sourcepub fn check(
&self,
rule_id: &str,
file_path: &Path,
finding_line: usize,
inline_suppressions: &[InlineSuppression],
fingerprint: Option<&str>,
) -> SuppressionResult
pub fn check( &self, rule_id: &str, file_path: &Path, finding_line: usize, inline_suppressions: &[InlineSuppression], fingerprint: Option<&str>, ) -> SuppressionResult
Check if a finding should be suppressed
Returns a SuppressionResult with details about why it was suppressed (or not). Order of checks:
- Always-enabled rules (never suppressed by path/preset)
- Inline suppressions
- Global path ignores
- Per-rule path ignores
- Default test/example presets
- Baseline
Sourcepub fn should_skip_path(&self, file_path: &Path) -> bool
pub fn should_skip_path(&self, file_path: &Path) -> bool
Check if a path should be completely ignored (before parsing/analysis)
This is a fast path check that doesn’t require inline suppressions. Only checks path-based ignores, not inline or baseline.
Sourcepub fn add_suppression_metadata(
properties: &mut HashMap<String, Value>,
result: &SuppressionResult,
)
pub fn add_suppression_metadata( properties: &mut HashMap<String, Value>, result: &SuppressionResult, )
Add suppression metadata to a finding’s properties