FormalConjecturesUtil/Linters/ModuleDocstringLinter.lean

GitHub source file

Explanation legend Lean4 Domain Explanation Language (L4DEL)

L4DEL explanations are a separate layer. They do not change the Lean source. Intuition is explanatory prose; numbered items are a reading path; sources link the wording back to evidence.

L4DEL
Lean4 Domain Explanation Language

Credit: The upstream authors and contributors retain credit for the project and mathematics. lean4-explainer only renders their pinned source and adds the separately disclosed explanation layer.

Project sources: Pinned project documentation, Formal Conjectures paper, arXiv v1

1 declarations, 0 contain sorry, 0 declared as axioms

The Module Docstring Linter

This file implements a linter that enforces module docstring hygiene:

  1. Missing module docstring: warns when a file has no /-! ... -/ block at all (detected on the first non-moduleDoc command).
  2. Duplicate module docstrings: warns when a file has more than one /-! ... -/ block (subsequent blocks should be regular /- ... -/ comments).
Imports (1)
Imported by 2 files
  1. def ModuleDocstringLinter.moduleDocstringLinter The module docstring linter checks two things: - A file that has no `/-! line 53 source

    Source documentation

    The module docstring linter checks two things:

    • A file that has no /-! ... -/ block gets a warning on its first non-moduleDoc command.
    • A file that has more than one /-! ... -/ block gets a warning on each extra block.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Lean.Elab.Command.Linter

    Proof uses: Lean.Elab.Command.Linter.mk, Lean.withSetOptionIn, Lean.Syntax, Bind.bind, Lean.Elab.Command.CommandElabM, String, Unit, Lean.MonadLog.getFileName, Lean.Environment, Lean.MonadEnv.getEnv, ite, Eq, Bool, BEq.beq, Lean.SyntaxNodeKind, Lean.Syntax.getKind, Lean.Name.mkStr4, Bool.true, Nat, HAdd.hAdd and 34 more

    28 instances, coercions and auxiliary constants left out.

    def moduleDocstringLinter : Linter where run := withSetOptionIn fun stx ↦ do
    …