Skip to main content

declare_forge_lint

Macro declare_forge_lint 

Source
macro_rules! declare_forge_lint {
    ($id:ident, $severity:expr, $str_id:expr, $desc:expr) => { ... };
}
Expand description

Macro for defining lints and relevant metadata for the Solidity linter.

§Parameters

Each lint requires the following input fields:

  • $id: Identifier of the generated SolLint constant.
  • $severity: The Severity of the lint (e.g. High, Med, Low, Info, Gas).
  • $str_id: A unique identifier used to reference a specific lint during configuration.
  • $desc: A short description of the lint.

§Note

Each lint must have a corresponding markdown documentation file at crates/lint/docs/<str_id>.md. The help URL is auto-generated by the macro and points to the per-lint page on the Foundry docs site (getfoundry.sh/forge/linting/<str_id>). To ensure that new lint rules have their corresponding docs, the existence of every registered lint’s markdown file is validated by a unit test (see crates/lint/src/sol/mod.rs).