Documentation

Lean.Linter.Init

Linter sets are represented as a map from linter name to set name, to make it easy to look up which sets to check for enabling a linter.

Equations
Instances For

    Insert a set into a LinterSets map.

    entry.1 is the name of the linter set, entry.2 contains the names of the set's linter options.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      The LinterOptions structure is used to determine whether given linters are enabled.

      This structure contains all the data required to do so, the Options set on the command line or by the set_option command, and the LinterSets that have been declared.

      A single structure holding this data is useful since we want getLinterValue to be a pure function: determining the LinterSets would otherwise require a MonadEnv instance.

      Instances For
        def Lean.Linter.LinterOptions.get {α : Type} [KVMap.Value α] (o : LinterOptions) (k : Name) (defVal : α) :
        α
        Equations
        Instances For
          Equations
          Instances For
            Equations
            Instances For

              Return the set of linter sets that this option is contained in.

              Equations
              Instances For

                Like getLinterValue, but the cross-linter fallback is linter.extra instead of linter.all.

                Equations
                Instances For

                  Tag attached by logLint to every linter warning so consumers (e.g. Lean.Linter.recordLints) can distinguish linter-produced messages from other tagged messages such as named errors or unknown-identifier messages.

                  Equations
                  Instances For
                    def Lean.Linter.logLint {m : TypeType} [Monad m] [MonadLog m] [AddMessageContext m] [MonadOptions m] (linterOption : Lean.Option Bool) (stx : Syntax) (msg : MessageData) :
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For

                      Returns true if msg was produced by Lean.Linter.logLint (and therefore by a linter).

                      Equations
                      Instances For
                        def Lean.Linter.logLintIf {m : TypeType} [Monad m] [MonadLog m] [AddMessageContext m] [MonadOptions m] [MonadEnv m] (linterOption : Lean.Option Bool) (stx : Syntax) (msg : MessageData) :

                        If linterOption is enabled, print a linter warning message at the position determined by stx.

                        Whether a linter option is enabled or not is determined by the following sequence:

                        1. If it is set, then the value determines whether or not it is enabled.
                        2. Otherwise, if linter.all is set, then its value determines whether or not the option is enabled.
                        3. Otherwise, if any of the linter sets containing the option is enabled, it is enabled. (Only enabled linter sets are considered: explicitly disabling a linter set will revert the linters it contains to their default behavior.)
                        4. Otherwise, the default value determines whether or not it is enabled.
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          def Lean.Linter.logLintIfExtra {m : TypeType} [Monad m] [MonadLog m] [AddMessageContext m] [MonadOptions m] [MonadEnv m] (linterOption : Lean.Option Bool) (stx : Syntax) (msg : MessageData) :

                          Like logLintIf, but uses getLinterValueExtra to gate emission on the extra fallback. Use for extra linters: emits the warning iff linterOption is on under the extra selection rules described on getLinterValueExtra.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For