Linters for Mathlib #
In this file we define additional linters for mathlib.
Perhaps these should be moved to Batteries in the future.
Linter that checks whether a structure should be in Prop.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Linter that check that all deprecated
tags come with since
dates.
Equations
- One or more equations did not get rendered due to their size.
Instances For
dupNamespace
linter #
The dupNamespace
linter produces a warning when a declaration contains the same namespace
at least twice consecutively.
For instance, Nat.Nat.foo
and One.two.two
trigger a warning, while Nat.One.Nat
does not.
The dupNamespace
linter is set on by default. Lean emits a warning on any declaration that
contains the same namespace at least twice consecutively.
For instance, Nat.Nat.foo
and One.two.two
trigger a warning, while Nat.One.Nat
does not.
Note.
This linter will not detect duplication in namespaces of autogenerated declarations
(other than the one whose declId
is present in the source declaration).
getIds stx
extracts the declId
nodes from the Syntax
stx
.
If stx
is an alias
or an export
, then it extracts an ident
, instead of a declId
.
The dupNamespace
linter is set on by default. Lean emits a warning on any declaration that
contains the same namespace at least twice consecutively.
For instance, Nat.Nat.foo
and One.two.two
trigger a warning, while Nat.One.Nat
does not.
Note.
This linter will not detect duplication in namespaces of autogenerated declarations
(other than the one whose declId
is present in the source declaration).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The "missing end" linter #
The "missing end" linter emits a warning on non-closed section
s and namespace
s.
It allows the "outermost" noncomputable section
to be left open (whether or not it is named).
The "missing end" linter emits a warning on non-closed section
s and namespace
s.
It allows the "outermost" noncomputable section
to be left open (whether or not it is named).
The "missing end" linter emits a warning on non-closed section
s and namespace
s.
It allows the "outermost" noncomputable section
to be left open (whether or not it is named).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The cdot
linter #
The cdot
linter is a syntax-linter that flags uses of the "cdot" ·
that are achieved
by typing a character different from ·
.
For instance, a "plain" dot .
is allowed syntax, but is flagged by the linter.
The cdot
linter flags uses of the "cdot" ·
that are achieved by typing a character
different from ·
.
For instance, a "plain" dot .
is allowed syntax, but is flagged by the linter.
findCDot stx
extracts from stx
the syntax nodes of kind
Lean.Parser.Term.cdot
or cdotTk
.
unwanted_cdot stx
returns an array of syntax atoms within stx
corresponding to cdot
s that are not written with the character ·
.
This is precisely what the cdot
linter flags.
Equations
- Mathlib.Linter.unwanted_cdot stx = Array.filter (fun (x : Lean.Syntax) => !Mathlib.Linter.isCDot? x) (Mathlib.Linter.findCDot stx) 0
Instances For
Gets the value of the linter.generic
option.
Equations
Instances For
The cdot
linter flags uses of the "cdot" ·
that are achieved by typing a character
different from ·
.
For instance, a "plain" dot .
is allowed syntax, but is flagged by the linter.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The "longLine" linter emits a warning on lines longer than 100 characters. We allow lines containing URLs to be longer, though.
The "longLine" linter emits a warning on lines longer than 100 characters. We allow lines containing URLs to be longer, though.
Equations
- One or more equations did not get rendered due to their size.