Commit fea9430
This PR configures the `mathlib` package so that the standard `lake lint` command is equivalent to `lake exe runLinter Mathlib`, by setting
```
lintDriver := "batteries/runLinter"
lintDriverArgs := #["Mathlib"]
```
on the `package mathlib` declaration. `runLinter` is already a `lean_exe` in batteries, so the `<pkg>/<name>` syntax lets mathlib reuse it directly.
The CI workflows in `build_template.yml` and `nolints.yml` are also switched from invoking `lake exe runLinter [args] Mathlib` to `lake lint -- [args]` so there's a single source of truth for "lint mathlib", and so that local users get the same behaviour as CI.
### Behavior change for local users
Before this PR, `lake lint` in a Mathlib checkout errored out with "no lint driver configured" and was essentially unused. After this PR, `lake lint` runs the full Batteries linter over all of Mathlib, which is a substantial multi-minute job. Anyone who has scripts or muscle memory expecting `lake lint` to be a no-op should be aware. The previous direct invocation, `lake exe runLinter Mathlib`, continues to work for anyone who prefers it.
The `scripts/bench/lint/` benchmark intentionally keeps the direct `lake exe runLinter Mathlib` invocation so its measurements are not affected by anything `lake lint` may do above the linter.
Motivated by a recent Zulip discussion in which it became clear that very few people know `lake lint` exists, partly because few packages bother to configure a lint driver:
https://leanprover.zulipchat.com/#narrow/channel/270676-lean4/topic/Using.20.60lake.20test.60.20effectively
Companion to leanprover/reference-manual#855 (which documents the mechanism in the Lean reference manual).
🤖 Prepared with Claude Code
1 parent 8a71bbc commit fea9430
3 files changed
Lines changed: 9 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
513 | 513 | | |
514 | 514 | | |
515 | 515 | | |
516 | | - | |
| 516 | + | |
| 517 | + | |
517 | 518 | | |
518 | 519 | | |
519 | | - | |
| 520 | + | |
520 | 521 | | |
521 | 522 | | |
522 | 523 | | |
523 | | - | |
| 524 | + | |
524 | 525 | | |
525 | 526 | | |
526 | | - | |
527 | | - | |
528 | | - | |
| 527 | + | |
| 528 | + | |
529 | 529 | | |
530 | 530 | | |
531 | 531 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
0 commit comments