The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V01. The language of Mathlib

Mathlib.Lean.Linter

3 declarations. Mathlib docs · Source

def Lean.Linter.whenLinterOption E1 #

{m : Type → Type} → [Monad m] → [Lean.MonadOptions m] → [Lean.MonadEnv m] → Lean.Option Bool → m Unit → m Unit

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.

def Lean.Linter.whenNotLinterOption E1 #

{m : Type → Type} → [Monad m] → [Lean.MonadOptions m] → [Lean.MonadEnv m] → Lean.Option Bool → m Unit → m Unit

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.

def Lean.Linter.whenLinterActivated E1 #

Lean.Option Bool → Lean.Elab.Command.CommandElab → optParam Bool true → Lean.Elab.Command.CommandElab

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.