Basic linter types and attributes #
This file defines the basic types and attributes used by the linting
framework.  A linter essentially consists of a function
(declaration : Name) → MetaM (Option MessageData), this function together with some
metadata is stored in the Linter structure. We define two attributes:
- @[env_linter]applies to a declaration of type- Linterand adds it to the default linter set.
- @[nolint linterName]omits the tagged declaration from being checked by the linter with name- linterName.
Returns true if decl is an automatically generated declaration.
Also returns true if decl is an internal name or created during macro
expansion.
A linting test for the #lint command.
- test : Lean.Name → Lean.MetaM (Option Lean.MessageData)testdefines a test to perform on every declaration. It should never fail. Returningnonesignifies a passing test. Returningsome msgreports a failing test with errormsg.
- noErrorsFound : Lean.MessageDatanoErrorsFoundis the message printed when all tests are negative
- errorsFound : Lean.MessageDataerrorsFoundis printed when at least one test is positive
- isFast : BoolIf isFastis false, this test will be omitted from#lint-.
Instances For
A NamedLinter is a linter associated to a particular declaration.
- name : Lean.NameThe name of the named linter. This is just the declaration name without the namespace. 
- declName : Lean.NameThe linter declaration name 
Instances For
Gets a linter by declaration name.
Equations
- Batteries.Tactic.Lint.getLinter name declName = Batteries.Tactic.Lint.getLinter.unsafe_impl_3✝ name declName
Instances For
Defines the env_linter extension for adding a linter to the default set.
Defines the @[env_linter] attribute for adding a linter to the default set.
The form @[env_linter disabled] will not add the linter to the default set,
but it will be shown by #list_linters and can be selected by the #lint command.
Linters are named using their declaration names, without the namespace. These must be distinct.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[nolint linterName] omits the tagged declaration from being checked by
the linter with name linterName.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Defines the user attribute nolint for skipping #lint
Returns true if decl should be checked
using linter, i.e., if there is no nolint attribute.
Equations
- Batteries.Tactic.Lint.shouldBeLinted linter decl = do let __do_lift ← Lean.getEnv pure !((Batteries.Tactic.Lint.nolintAttr.getParam? __do_lift decl).getD #[]).contains linter