Basic environment linter types and attributes #
This file defines the basic types and attributes used by the environment
linting framework. An environment linter consists of a function
(declaration : Name) → MetaM (Option MessageData), this function together with some
metadata is stored in the EnvLinter structure. We define two attributes:
@[builtin_env_linter]applies to a declaration of typeEnvLinterand adds it to the default linter set.@[builtin_nolint linterName]omits the tagged declaration from being checked by the linter with namelinterName.
Returns true if decl is an automatically generated declaration.
Also returns true if decl is an internal name or created during macro
expansion.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An environment linting test for the lake builtin-lint command.
- test : Name → MetaM (Option 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 : MessageData
noErrorsFoundis the message printed when all tests are negative - errorsFound : MessageData
errorsFoundis printed when at least one test is positive - isDefault : Bool
If
isDefaultis false, this linter is only run when--extrais passed.
Instances For
A NamedEnvLinter is an environment linter associated to a particular declaration.
- test : Name → MetaM (Option MessageData)
- name : Name
The name of the named linter. This is just the declaration name without the namespace.
- declName : Name
The linter declaration name
Instances For
Gets an environment linter by declaration name.
Equations
- Lean.Linter.EnvLinter.getEnvLinter name declName = Lean.Linter.EnvLinter.getEnvLinter.unsafe_impl_2✝ name declName
Instances For
Defines the envLinterExt extension for adding an environment linter to the default set.
Defines the @[builtin_env_linter] attribute for adding a linter to the default set.
The form @[builtin_env_linter extra] will not add the linter to the default set,
but it can be selected by lake builtin-lint --extra.
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.