pub trait Linter:
Send
+ Sync
+ Clone {
type Language: Language;
type Lint: Lint;
// Required methods
fn init(&self) -> Session;
fn early_lint<'sess>(&self, input: &[PathBuf], pcx: ParsingContext<'sess>);
fn late_lint<'sess>(&self, input: &[PathBuf], pcx: ParsingContext<'sess>);
}Expand description
Trait representing a generic linter for analyzing and reporting issues in smart contract source code files. A linter can be implemented for any smart contract language supported by Foundry.
§Type Parameters
Language: Represents the target programming language. Must implement the [Language] trait.Lint: Represents the types of lints performed by the linter. Must implement theLinttrait.
§Required Methods
init: Creates a new solarSessionwith the appropriate linter configuration.early_lint: Scans the source files (using the AST) emitting a diagnostic for lints found.late_lint: Scans the source files (using the HIR) emitting a diagnostic for lints found.
§Note:
- For
early_lintandlate_lint, theParsingContextshould have the sources pre-loaded.
Required Associated Types§
Required Methods§
fn init(&self) -> Session
fn early_lint<'sess>(&self, input: &[PathBuf], pcx: ParsingContext<'sess>)
fn late_lint<'sess>(&self, input: &[PathBuf], pcx: ParsingContext<'sess>)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.