pub trait Plugin: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn analyze(&self, ctx: &AnalysisContext<'_>) -> Vec<Finding>;
// Provided methods
fn version(&self) -> &str { ... }
fn description(&self) -> &str { ... }
fn authors(&self) -> Vec<String> { ... }
fn smells(&self) -> Vec<String> { ... }
fn try_fix(
&self,
finding: &Finding,
ctx: &AnalysisContext<'_>,
) -> Option<Patch> { ... }
}Expand description
Core trait that all analyzers implement.
Required Methods§
Sourcefn analyze(&self, ctx: &AnalysisContext<'_>) -> Vec<Finding>
fn analyze(&self, ctx: &AnalysisContext<'_>) -> Vec<Finding>
Run analysis on a single file and return findings.
Provided Methods§
Sourcefn description(&self) -> &str
fn description(&self) -> &str
Short description of what the plugin detects.
List of authors.
Sourcefn smells(&self) -> Vec<String>
fn smells(&self) -> Vec<String>
Smell names this plugin can produce.
Used by the host for smell-level filtering, docs, and cha plugin list.
Default is empty — plugins should override to declare their smells.
Sourcefn try_fix(&self, finding: &Finding, ctx: &AnalysisContext<'_>) -> Option<Patch>
fn try_fix(&self, finding: &Finding, ctx: &AnalysisContext<'_>) -> Option<Patch>
Try to produce a Patch that fixes finding. Returning None means
either no safe automatic fix exists or this plugin doesn’t own the
smell. Only one plugin produces edits per finding (registry order);
overlapping edits across plugins are undefined.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".