Skip to content

feat: lake: support package code quality checks in lake lint - #14716

Open
wkrozowski wants to merge 6 commits into
leanprover:masterfrom
wkrozowski:wkr/package-check-run
Open

feat: lake: support package code quality checks in lake lint#14716
wkrozowski wants to merge 6 commits into
leanprover:masterfrom
wkrozowski:wkr/package-check-run

Conversation

@wkrozowski

@wkrozowski wkrozowski commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

This PR makes lake lint --code-quality run the package code quality checks registered with the @[package_code_quality_check] attribute. The checks are discovered in each lint target's import closure and run once per target, and their results are emitted as JSON entries alongside the linter-derived ones. Additional modules providing checks can be supplied with the new --checks CLI option (which implies --code-quality) or the new checks package configuration option; these modules are built and then imported alongside each linted module, so checks can be used without adding them to the package's own imports.

Each check runs in MetaM against the lint target's environment and receives the target's name as topLevelModule in its PackageCheckContext, so it can inspect the elaborated declarations of the module being linted and scope its metrics to it. Checks run concurrently, one task per check; a failing check is reported on stderr and makes lake lint exit nonzero without discarding the results of the other checks.

@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Aug 7, 2026
@mathlib-lean-pr-testing

mathlib-lean-pr-testing Bot commented Aug 7, 2026

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 4a37393b74d177d5e32f06cfd097ff6eb9f507b8 --onto bd97ed8e35639e17a11d1490cbc46d994e7b4513. You can force Mathlib CI using the force-mathlib-ci label. (2026-08-07 16:45:53)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 4a37393b74d177d5e32f06cfd097ff6eb9f507b8 --onto b1cd183c9978c3bedddc33baf7c9599baaeca046. You can force Mathlib CI using the force-mathlib-ci label. (2026-08-10 10:48:16)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 4a37393b74d177d5e32f06cfd097ff6eb9f507b8 --onto 3fc29d37a70f8fd904ebab848557c12383543008. You can force Mathlib CI using the force-mathlib-ci label. (2026-08-10 23:07:57)

@leanprover-bot

leanprover-bot commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 4a37393b74d177d5e32f06cfd097ff6eb9f507b8 --onto c4e6b62c3d955ef20da94310797072f7c4c5fa2b. You can force reference manual CI using the force-manual-ci label. (2026-08-07 16:45:55)
  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 4a37393b74d177d5e32f06cfd097ff6eb9f507b8 --onto b1cd183c9978c3bedddc33baf7c9599baaeca046. You can force reference manual CI using the force-manual-ci label. (2026-08-10 10:48:18)
  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 4a37393b74d177d5e32f06cfd097ff6eb9f507b8 --onto 3fc29d37a70f8fd904ebab848557c12383543008. You can force reference manual CI using the force-manual-ci label. (2026-08-10 23:07:59)

@wkrozowski
wkrozowski marked this pull request as ready for review August 11, 2026 09:57
@wkrozowski
wkrozowski requested a review from tydeu as a code owner August 11, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-lake Lake toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants