pub struct EcosystemRules { /* private fields */ }Expand description
Ecosystem-specific normalization and matching rules.
Implementations§
Source§impl EcosystemRules
impl EcosystemRules
Sourcepub fn with_config(config: EcosystemRulesConfig) -> Self
pub fn with_config(config: EcosystemRulesConfig) -> Self
Create ecosystem rules with custom configuration
Sourcepub fn from_file(path: &Path) -> Result<Self, ConfigError>
pub fn from_file(path: &Path) -> Result<Self, ConfigError>
Load configuration from a file
Sourcepub fn from_default_locations() -> Self
pub fn from_default_locations() -> Self
Load configuration from default locations with precedence
Sourcepub const fn config(&self) -> &EcosystemRulesConfig
pub const fn config(&self) -> &EcosystemRulesConfig
Get the underlying configuration
Sourcepub fn normalize_name(&self, name: &str, ecosystem: &Ecosystem) -> String
pub fn normalize_name(&self, name: &str, ecosystem: &Ecosystem) -> String
Normalize a package name according to ecosystem rules
Sourcepub fn names_match(
&self,
name_a: &str,
name_b: &str,
ecosystem: &Ecosystem,
) -> bool
pub fn names_match( &self, name_a: &str, name_b: &str, ecosystem: &Ecosystem, ) -> bool
Check if two names match according to ecosystem rules
Sourcepub fn get_canonical(&self, name: &str, ecosystem: &Ecosystem) -> Option<String>
pub fn get_canonical(&self, name: &str, ecosystem: &Ecosystem) -> Option<String>
Get the canonical name for an alias
Sourcepub fn is_alias(
&self,
canonical: &str,
name: &str,
ecosystem: &Ecosystem,
) -> bool
pub fn is_alias( &self, canonical: &str, name: &str, ecosystem: &Ecosystem, ) -> bool
Check if a name is an alias of a canonical name
Sourcepub fn get_strip_suffixes(&self, ecosystem: &Ecosystem) -> Vec<&str>
pub fn get_strip_suffixes(&self, ecosystem: &Ecosystem) -> Vec<&str>
Get common suffixes to strip for a given ecosystem
Sourcepub fn get_strip_prefixes(&self, ecosystem: &Ecosystem) -> Vec<&str>
pub fn get_strip_prefixes(&self, ecosystem: &Ecosystem) -> Vec<&str>
Get common prefixes to strip for a given ecosystem
Sourcepub fn strip_affixes(&self, name: &str, ecosystem: &Ecosystem) -> String
pub fn strip_affixes(&self, name: &str, ecosystem: &Ecosystem) -> String
Normalize name by stripping common prefixes/suffixes
Sourcepub fn is_typosquat(
&self,
name: &str,
ecosystem: &Ecosystem,
) -> Option<&TyposquatEntry>
pub fn is_typosquat( &self, name: &str, ecosystem: &Ecosystem, ) -> Option<&TyposquatEntry>
Check if a package name is a known typosquat
Sourcepub fn is_suspicious(&self, name: &str, ecosystem: &Ecosystem) -> bool
pub fn is_suspicious(&self, name: &str, ecosystem: &Ecosystem) -> bool
Check if a package name matches suspicious patterns
Sourcepub fn is_known_malicious(&self, name: &str, ecosystem: &Ecosystem) -> bool
pub fn is_known_malicious(&self, name: &str, ecosystem: &Ecosystem) -> bool
Check if a package is a known malicious package
Sourcepub fn get_migrated_group(
&self,
group: &str,
ecosystem: &Ecosystem,
) -> Option<String>
pub fn get_migrated_group( &self, group: &str, ecosystem: &Ecosystem, ) -> Option<String>
Get the migrated group ID (for Maven javax -> jakarta, etc.)
Sourcepub fn get_package_group(
&self,
name: &str,
ecosystem: &Ecosystem,
) -> Option<&str>
pub fn get_package_group( &self, name: &str, ecosystem: &Ecosystem, ) -> Option<&str>
Check if a package is part of a package group
Sourcepub fn get_cross_ecosystem_equivalent(
&self,
concept: &str,
target_ecosystem: &Ecosystem,
) -> Option<&str>
pub fn get_cross_ecosystem_equivalent( &self, concept: &str, target_ecosystem: &Ecosystem, ) -> Option<&str>
Get cross-ecosystem equivalent package
Sourcepub fn is_internal_package(&self, name: &str) -> bool
pub fn is_internal_package(&self, name: &str) -> bool
Check if a package is an internal/organization package
Sourcepub fn is_ignored(&self, name: &str) -> bool
pub fn is_ignored(&self, name: &str) -> bool
Check if a package should be ignored in diffs
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EcosystemRules
impl RefUnwindSafe for EcosystemRules
impl Send for EcosystemRules
impl Sync for EcosystemRules
impl Unpin for EcosystemRules
impl UnsafeUnpin for EcosystemRules
impl UnwindSafe for EcosystemRules
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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