pub struct AnalyzerEngine { /* private fields */ }Expand description
The main analysis engine
Combines native RMA rules with optional external providers (PMD, Oxlint) for comprehensive code analysis across multiple languages.
Implementations§
Source§impl AnalyzerEngine
impl AnalyzerEngine
Sourcepub fn new(config: RmaConfig) -> Self
pub fn new(config: RmaConfig) -> Self
Create a new analyzer with default rules (no external providers)
Sourcepub fn with_providers(
config: RmaConfig,
providers_config: ProvidersConfig,
) -> Self
pub fn with_providers( config: RmaConfig, providers_config: ProvidersConfig, ) -> Self
Create a new analyzer with specified providers
Sourcepub fn is_provider_enabled(&self, provider_type: ProviderType) -> bool
pub fn is_provider_enabled(&self, provider_type: ProviderType) -> bool
Check if a provider is enabled
Sourcepub fn available_providers(&self) -> Vec<&str>
pub fn available_providers(&self) -> Vec<&str>
Get list of available providers
Sourcepub fn analyze_file(&self, parsed: &ParsedFile) -> Result<FileAnalysis>
pub fn analyze_file(&self, parsed: &ParsedFile) -> Result<FileAnalysis>
Analyze a single parsed file using native rules only
Sourcepub fn analyze_files(
&self,
files: &[ParsedFile],
) -> Result<(Vec<FileAnalysis>, AnalysisSummary)>
pub fn analyze_files( &self, files: &[ParsedFile], ) -> Result<(Vec<FileAnalysis>, AnalysisSummary)>
Analyze multiple parsed files in parallel
This is the legacy method without caching support. For better performance
on repeated scans, use analyze_files_cached instead.
Sourcepub fn analyze_files_cached(
&self,
files: &[ParsedFile],
cache: Option<&mut AnalysisCache>,
) -> Result<(Vec<FileAnalysis>, AnalysisSummary)>
pub fn analyze_files_cached( &self, files: &[ParsedFile], cache: Option<&mut AnalysisCache>, ) -> Result<(Vec<FileAnalysis>, AnalysisSummary)>
Analyze multiple parsed files in parallel with optional caching
When a cache is provided:
- Files with unchanged content (based on hash) use cached results
- Only modified/new files are analyzed
- Fresh analysis results are stored in the cache
- Combined results (cached + fresh) are returned
This can reduce scan time by 80-90% for repeated scans of the same codebase.
Sourcepub fn analyze_directory_with_providers(
&self,
path: &Path,
) -> Result<Vec<Finding>>
pub fn analyze_directory_with_providers( &self, path: &Path, ) -> Result<Vec<Finding>>
Run provider analysis on a directory
This is more efficient for providers that support batch analysis (like PMD which can analyze a whole directory at once).
Sourcepub fn analyze_files_with_providers(
&self,
files: &[ParsedFile],
base_path: &Path,
) -> Result<(Vec<FileAnalysis>, AnalysisSummary)>
pub fn analyze_files_with_providers( &self, files: &[ParsedFile], base_path: &Path, ) -> Result<(Vec<FileAnalysis>, AnalysisSummary)>
Analyze files with both native rules and providers
This combines:
- Native rule analysis (per-file, parallel)
- Provider analysis (batch where possible)
Auto Trait Implementations§
impl Freeze for AnalyzerEngine
impl !RefUnwindSafe for AnalyzerEngine
impl Send for AnalyzerEngine
impl Sync for AnalyzerEngine
impl Unpin for AnalyzerEngine
impl !UnwindSafe for AnalyzerEngine
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