Skip to main content

EcosystemRules

Struct EcosystemRules 

Source
pub struct EcosystemRules { /* private fields */ }
Expand description

Ecosystem-specific normalization and matching rules.

Implementations§

Source§

impl EcosystemRules

Source

pub fn new() -> Self

Create a new ecosystem rules instance with built-in defaults

Source

pub fn with_config(config: EcosystemRulesConfig) -> Self

Create ecosystem rules with custom configuration

Source

pub fn from_file(path: &Path) -> Result<Self, ConfigError>

Load configuration from a file

Source

pub fn from_default_locations() -> Self

Load configuration from default locations with precedence

Source

pub const fn config(&self) -> &EcosystemRulesConfig

Get the underlying configuration

Source

pub fn normalize_name(&self, name: &str, ecosystem: &Ecosystem) -> String

Normalize a package name according to ecosystem rules

Source

pub fn names_match( &self, name_a: &str, name_b: &str, ecosystem: &Ecosystem, ) -> bool

Check if two names match according to ecosystem rules

Source

pub fn get_canonical(&self, name: &str, ecosystem: &Ecosystem) -> Option<String>

Get the canonical name for an alias

Source

pub fn is_alias( &self, canonical: &str, name: &str, ecosystem: &Ecosystem, ) -> bool

Check if a name is an alias of a canonical name

Source

pub fn get_strip_suffixes(&self, ecosystem: &Ecosystem) -> Vec<&str>

Get common suffixes to strip for a given ecosystem

Source

pub fn get_strip_prefixes(&self, ecosystem: &Ecosystem) -> Vec<&str>

Get common prefixes to strip for a given ecosystem

Source

pub fn strip_affixes(&self, name: &str, ecosystem: &Ecosystem) -> String

Normalize name by stripping common prefixes/suffixes

Source

pub fn is_typosquat( &self, name: &str, ecosystem: &Ecosystem, ) -> Option<&TyposquatEntry>

Check if a package name is a known typosquat

Source

pub fn is_suspicious(&self, name: &str, ecosystem: &Ecosystem) -> bool

Check if a package name matches suspicious patterns

Source

pub fn is_known_malicious(&self, name: &str, ecosystem: &Ecosystem) -> bool

Check if a package is a known malicious package

Source

pub fn get_migrated_group( &self, group: &str, ecosystem: &Ecosystem, ) -> Option<String>

Get the migrated group ID (for Maven javax -> jakarta, etc.)

Source

pub fn get_package_group( &self, name: &str, ecosystem: &Ecosystem, ) -> Option<&str>

Check if a package is part of a package group

Source

pub fn get_cross_ecosystem_equivalent( &self, concept: &str, target_ecosystem: &Ecosystem, ) -> Option<&str>

Get cross-ecosystem equivalent package

Source

pub fn is_internal_package(&self, name: &str) -> bool

Check if a package is an internal/organization package

Source

pub fn is_ignored(&self, name: &str) -> bool

Check if a package should be ignored in diffs

Trait Implementations§

Source§

impl Default for EcosystemRules

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more