You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: control environment linters with Lean.Option (#13893)
This PR makes environment linters (the declaration-level checks run by
`lake lint --builtin-lint`) controlled by `Lean.Option`s, just like
ordinary linters. Each environment linter is tied to a boolean option,
so you enable or disable it per declaration with `set_option linter.X
false in ...` and across a lint run with the new `lake lint
--linters=linter.X,-linter.Y` flag. Using `--lint-only` with the same
syntax will only collect information from the specified linters and will
not run the default on linters. The previous `lake lint` flags
`--extra`, `--lint-all`, and the `builtin_nolint` attribute, are removed
in favour of this option-based control.
Whether a linter applies to a declaration is decided by the value of its
controlling option at the time that declaration was elaborated.
`Lean.addDecl` snapshots the resolved value of every registered
environment-linter option for each new declaration (also from
`Elab.MutualDef`, where the inner `addDecl` runs on an async
environment) and stores it in an environment extension that `lake
builtin-lint` reads. The `@[builtin_env_linter linter.X]` attribute now
takes the controlling option name, and the registry maps option name to
linter declaration. `--linters` is translated into `weak` option
overrides applied to the lint build. `isAutoDecl` moves to a new
`Lean.AutoDecl` module so `Lean.addDecl` can use it.
Builds on #13852 (builtin linter sets); `linter.extra` becomes a linter
set whose members are the existing extra linters.
@claude was used to update the help string in Lake CLI, readapt the
tests (that were then manually cleaned) and to write this PR
description.
0 commit comments