feat: control environment linters with Lean.Options#13893
Draft
wkrozowski wants to merge 11 commits into
Draft
Conversation
EnvironmentLinter linters are controlled using Lean.OptionLean.Options
Contributor
Author
|
@Kha could you please have a look at this PR? In particular I would like to hear your input about my approach to persisting the state of options associated with environment linters while adding declarations, that are not picked by |
|
Mathlib CI status (docs):
|
Collaborator
|
Reference manual CI status:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR makes environment linters (the declaration-level checks run by
lake lint --builtin-lint) controlled byLean.Options, just like ordinary linters. Each environment linter is tied to a boolean option, so you enable or disable it per declaration withset_option linter.X false in ...and across a lint run with the newlake lint --linters=linter.X,-linter.Yflag. The previouslake lintflags--extra,--lint-all, and--lint-only, and thebuiltin_nolintattribute, 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.addDeclsnapshots the resolved value of every registered environment-linter option for each new declaration (also fromElab.MutualDef, where the inneraddDeclruns on an async environment) and stores it in an environment extension thatlake builtin-lintreads. The@[builtin_env_linter linter.X]attribute now takes the controlling option name, and the registry maps option name to linter declaration.--lintersis translated intoweakoption overrides applied to the lint build.isAutoDeclmoves to a newLean.AutoDeclmodule soLean.addDeclcan use it.Builds on #13852 (builtin linter sets);
linter.extrabecomes 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.