Skip to main content

Linter

Trait Linter 

Source
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 the Lint trait.

§Required Methods

  • init: Creates a new solar Session with 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_lint and late_lint, the ParsingContext should have the sources pre-loaded.

Required Associated Types§

Source

type Language: Language

Source

type Lint: Lint

Required Methods§

Source

fn init(&self) -> Session

Source

fn early_lint<'sess>(&self, input: &[PathBuf], pcx: ParsingContext<'sess>)

Source

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.

Implementors§