[Merged by Bors] - feat: a linter to deprecate imported modules#20987
[Merged by Bors] - feat: a linter to deprecate imported modules#20987
Conversation
PR summary 988edcd197Import changes exceeding 2%
|
| File | Base Count | Head Count | Change |
|---|---|---|---|
| Mathlib.Tactic.Linter | 32 | 34 | +2 (+6.25%) |
| Mathlib.Tactic | 2686 | 2688 | +2 (+0.07%) |
Import changes for all files
| Files | Import difference |
|---|---|
| There are 5363 files with changed transitive imports taking up over 231742 characters: this is too many to display! | |
You can run scripts/import_trans_difference.sh all locally to see the whole output. |
Declarations diff
+ addModuleDeprecation
+ deprecated.moduleLinter
You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>The doc-module for script/declarations_diff.sh contains some details about this script.
No changes to technical debt.
You can run this locally as
./scripts/technical-debt-metrics.sh pr_summary
- The
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
|
Maybe |
|
!bench |
1 similar comment
|
!bench |
grunweg
left a comment
There was a problem hiding this comment.
I don't have strong opinions on the environment extension set-up (for lack for time spent with them); the remaining infrastructure looks very good. Find below my usual collection of small polish comments.
| elab "show_deprecated_modules" : command => do | ||
| let directImports := deprecateModuleExt.getState (← getEnv) | ||
| logInfo <| "\n".intercalate <| | ||
| directImports.fold (init := ["Deprecated modules\n"]) fun nms (i, deps) => |
There was a problem hiding this comment.
I'm pretty sure there's room for bikeshedding this formatting. I think we can land something and iterate.
There was a problem hiding this comment.
Can we use the same import linking that find_home emits?
There was a problem hiding this comment.
I don't have time to look into this now, but I like the idea!
Co-authored-by: grunweg <rothgami@math.hu-berlin.de>
…over-community/mathlib4 into adomani/deprecated_imports_linter
|
Here are the benchmark results for commit c2b50b2. |
|
adomani
left a comment
There was a problem hiding this comment.
Thanks, Michael!
I acted on all comments, except extracting the code from the header linter, since that would take a little more thought.
|
!bench |
|
Here are the benchmark results for commit 5191403. |
|
I removed the intermediate |
The latter option sounds good. I could implement that tweak tomorrow (or so). |
This modification was easy enough that I just pushed it. |
|
(The current state still looks good to me.) |
|
Optional, but it might be nice to allow an optional text argument, that would be displayed with the suggestion. |
|
bors d+ |
|
✌️ adomani can now approve this pull request. To approve and merge a pull request, simply reply with |
|
Kim, thank you for the suggestions! @grunweg I implemented all of Kim's changes: if you want to take a look at them, I'll wait for a few hours before merging. |
|
The changes look great to me; I just pushed one more test. |
|
I'm not sure how to fix the CI failure. The error is |
|
I commented out the failing test: it was failing due to some incompatibility of the Assuming that this version passes CI, I will merge and we can see whether we want to fix the CI setup in a separate PR. |
|
bors merge |
Writing ```lean import Bar1 import Bar2 deprecated_module since yyyy-mm-dd ``` in file `A.lean` means that any file that imports `A` will have `import A` flagged with a suggestion to import `Bar1` and `Bar2` instead. [Zulip discussion](https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/.60Deprecated.60.20folder) Co-authored-by: Michael Rothgang <rothgang@math.uni-bonn.de>
|
Pull request successfully merged into master. Build succeeded: |
Writing ```lean import Bar1 import Bar2 deprecated_module since yyyy-mm-dd ``` in file `A.lean` means that any file that imports `A` will have `import A` flagged with a suggestion to import `Bar1` and `Bar2` instead. [Zulip discussion](https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/.60Deprecated.60.20folder) Co-authored-by: Michael Rothgang <rothgang@math.uni-bonn.de>
Writing
in file
A.leanmeans that any file that importsAwill haveimport Aflagged with a suggestion to importBar1andBar2instead.Zulip discussion