Skip to main content

SuppressionEngine

Struct SuppressionEngine 

Source
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

Source

pub fn new(rules_config: &RulesConfig, use_default_presets: bool) -> Self

Create a new suppression engine from config

Source

pub fn with_defaults_only() -> Self

Create a suppression engine with just default presets (no config)

Source

pub fn with_baseline(self, baseline: Baseline) -> Self

Set the baseline for filtering

Source

pub fn with_store(self, store: SuppressionStore) -> Self

Set the suppression store for database-backed suppressions

Source

pub fn with_store_ref(self, store: Arc<SuppressionStore>) -> Self

Set a shared suppression store reference

Source

pub fn store(&self) -> Option<&SuppressionStore>

Get a reference to the suppression store (if available)

Source

pub fn with_skip_security_in_tests(self, skip: bool) -> Self

Enable skipping security rules in test paths (–skip-tests-all)

Source

pub fn is_always_enabled(rule_id: &str) -> bool

Check if a rule is in the always-enabled list (security rules)

Source

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:

  1. Always-enabled rules (never suppressed by path/preset)
  2. Inline suppressions
  3. Global path ignores
  4. Per-rule path ignores
  5. Default test/example presets
  6. Baseline
Source

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.

Source

pub fn add_suppression_metadata( properties: &mut HashMap<String, Value>, result: &SuppressionResult, )

Add suppression metadata to a finding’s properties

Trait Implementations§

Source§

impl Default for SuppressionEngine

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.