Repository navigation
Conversation
Every file importing Mathlib.Init transitively imports this file already, thus having its module docstring and copyright header checked by the header linter. This adds the same input to every file *imported in* Mathlib.Init. Helps with #17556.
This manually adds 'import Mathlib.Init' to all files which are currently missing this. A future PR will add an automatic check for this.
Stream'.corec' was pre-existing; add it to the exceptions list
PR summary 542f8bf287Import changes for modified filesNo significant changes to the import graph Import changes for all files
Declarations diff
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 |
|
Right now the module doc of Mathlib.Init says something like "this file is imported by virtually every file in Mathlib". If we add this linter, perhaps we should update that text and also mention that it's enforced by litner. |
|
Good point, updated the doc-string! |
adomani
left a comment
There was a problem hiding this comment.
Thanks! Just a few minor remarks.
| modulesWithoutMathlibImports := modulesWithoutMathlibImports.push module | ||
|
|
||
| -- We check that each of these is imported in `Mathlib/Init.lean`. | ||
| let initImports := (← IO.FS.lines "Mathlib/Init.lean").filter (·.startsWith "import ") |
There was a problem hiding this comment.
If the linter is ran on a computer with path-separator different from /. then the path Mathlib/Init.lean would not be recognized, right?
I also wonder about the lean extension in allModules.
There was a problem hiding this comment.
Good catch! Should somebody write a linter against scripts doing manual path manipulation like this? At least for mathlib scripts, gradually forcing less use of duct tape could be useful :-)
allModules parses Mathlib.lean --- lines in it look like import Mathlib.Algebra.Algebra.Pi, so allModules contains entries like Mathlib.Algebra.Algebra.Pi, i.e. is a list of module names. Does that answer your question?
There was a problem hiding this comment.
I was more wondering about Mathlib.lean and whether there might be some system-dependent issue in using the extension "manually" instead of going via some addExtension API. It looks fine as is, though.
|
Thanks for the comments; I have updated the code accordingly. |
And remove Mathlib.Init.Align, which does not exist any more.
|
I realised that this PR presumably makes |
|
I am suddenly a bit confused about this "duplication" of It seems that before However, now everything that is imported by Would it make more sense to check that every file in |
|
This is also a comment about #18275, right? Taking a step back:
I am happy to un-import the header linter, but that means a previous concern of yours in addressed less. What do you think which of these options do you prefer? I would like to, however, land this check for importing |
|
Thanks for explaining - I have clarified the comment now, and made |
|
I just merged master again. Assuming CI passes, is there anything left you would like to see? |
adomani
left a comment
There was a problem hiding this comment.
Apart from the (optional) style suggestions, I am happy with this version, thanks!
maintainer delegate
|
🚀 Pull request has been placed on the maintainer queue by adomani. |
|
Thanks for the style suggestions! Both work, so I applied them. |
Vierkantor
left a comment
There was a problem hiding this comment.
LGTM, thanks!
bors d+
|
✌️ grunweg can now approve this pull request. To approve and merge a pull request, simply reply with |
Co-authored-by: Anne Baanen <[email protected]>
|
Thanks for the review! |
Its functionality has been replaced by a text-based linter in #18281.
We add a text-based check to the `lint-style` script, that every file either (transitively) imports Mathlib.Init, or is (transitively) imported by it. Co-authored-by: grunweg <[email protected]>
|
Pull request successfully merged into master. Build succeeded: |
Its functionality has been replaced by a text-based linter in #18281.
Its functionality has been replaced by a text-based linter in #18281.
Its functionality has been replaced by a text-based linter in #18281.
We add a text-based check to the `lint-style` script, that every file either (transitively) imports Mathlib.Init, or is (transitively) imported by it. Co-authored-by: grunweg <[email protected]>
Its functionality has been replaced by a text-based linter in #18281.
We add a text-based check to the
lint-stylescript, that every file either (transitively) imports Mathlib.Init, or is (transitively) imported by it.