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.
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)
- optName : Name
The option name associated to the linter.
- declName : Name
The linter declaration name
Instances For
Gets an environment linter by option name.
Equations
- Lean.Linter.EnvLinter.getEnvLinter optName declName = Lean.Linter.EnvLinter.getEnvLinter.unsafe_impl_2✝ optName declName
Instances For
Defines the envLinterExt extension for adding an environment linter to the default set.
Defines the builtin_env_linter attribute for registering an environment linter.
Each environment linter needs to have a registered Boolean-value Lean.Option that will be
associated with it by providing the option name in the attribute, i.e.
@[builtin_env_linter linter.envLinter.myLinter].
Equations
- One or more equations did not get rendered due to their size.