`lake` should give a warning when it looks like nothing is imported, by accident
@tydeu is already working on this.
Since May 8, 2024.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
A pretty common user error in a project Foo is to neither modify Foo.lean to import their "interesting" files e.g. Foo/XYZ.lean nor to use globs := #[.submodules `Foo] in their lean_lib (which, as far as I'm aware, is only discoverable by asking on zulip).
They just leave Foo.lean with its default contents, and get to work in the Foo directory, relying on VSCode to show them errors when they open files.
This has the effect that lake build is essentially a no-op.
This is sufficiently common that I think we need to do something about it. It's good that the default template now has a
-- Import modules here that should be built as part of the library.
import «Foo».Basic
but I think this isn't enough.
Possible solutions:
- We switch the default
lakefile.leanto use globs, e.g. something like:
lean_lib «Foo» where
-- This setting causes `lake build Foo` to build all `.lean` files in the `Foo/` directory.
-- You can remove this and instead import only the files you want to build in `Foo.lean`.
globs := #[.submodules `Foo]
- We try to detect if the user is confused (e.g.
Foo.leanonly containsimport Foo.Basic, there is no globs setting, but there are other lean files underFoo/), and if so give them explanatory text or a warning. - We ship something that automatically updates
Foo.lean(lake update-imports??), and warns when it is out of sync, with an option to silence the warning for experts.
(I prefer 1. over 2. over 3.)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.