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.

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.

    Instances For

      State of linterSetsExt.

      merged is the queryable union of all sources (builtins folded in at env creation, imported entries from oleans, and locally added entries). localEntries tracks entries added in the current module so they can be exported into the olean.

      Instances For

        Builtin linter sets registered from builtin_initialize blocks in core code.

        Entries here are folded into every LinterSetsState produced by linterSetsExt, so they participate in getLinterValue like any user-declared set.

        def Lean.Linter.addBuiltinLinterSet (setName : Name) (linterNames : NameSet) :

        Register a builtin linter set entry. Only valid during initialization.

        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 : α) :
            α
            Instances For
              Instances For

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

                Instances For

                  Global registry of options associated with environment linters. These are precisely options, whose value will be snapshotted during addDecl.

                  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.

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

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

                      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.
                        Instances For
                          @[reducible, inline]
                          Instances For

                            The envLinterSnapshotExt extension saves the state of all (Boolean-valued) Lean.Options associated with environment linters.

                            Instances For