Additional utilities and boilerplate for the Linter API #
Runs a CommandElabM action when the provided linter option is true.
This function assumes you have already called withSetOptionIn; use whenLinterActivated
to do so automatically. At the start of linter code, whenLinterActivated should be preferred when
possible.
Note: this definition is marked as @[macro_inline], so it is okay to supply it with a linter
option which has been registered in the same module.
Equations
- Lean.Linter.whenLinterOption opt x = do let __do_lift ← Lean.Linter.getLinterOptions if Lean.Linter.getLinterValue opt __do_lift = true then x else pure PUnit.unit
Instances For
Runs a CommandElabM action when the provided linter option is false.
Note: this definition is marked as @[macro_inline], so it is okay to supply it with a linter
option which has been registered in the same module.
Equations
- Lean.Linter.whenNotLinterOption opt x = do let __do_lift ← Lean.Linter.getLinterOptions if Lean.Linter.getLinterValue opt __do_lift = true then pure PUnit.unit else x
Instances For
Processes set_option ... ins that wrap the input stx, then acts on the inner syntax with
x after checking that the provided linter option is true.
If breakOnError is true (the default), avoids running the linter when errors are present.
This is typically used to start off linter code:
def myLinter : Linter where
run := whenLinterActivated linter.myLinter fun stx ↦ do
...
Note: this definition is marked as @[macro_inline], so it is okay to supply it with a linter
option which has been registered in the same module.
Equations
- One or more equations did not get rendered due to their size.