mathlib4 icon indicating copy to clipboard operation
mathlib4 copied to clipboard

feat: add `endOf` linter

Open adomani opened this issue 1 year ago • 1 comments

This linter emits a warning at the end of a file if there are unclosed namespaces or sections.

Unlike #14352, this PR does leaves outermost noncomputable sections open.

Zulip thread


Self-correcting script:

eval "$(
  lake build |
    grep -v "^\(✔ \[\|note: \|⚠ \[\|trace: \|Build completed\)" |
      sed -z "s=warning: \./\./\./\./\([^:]*\):[^']*'\([^']*\)'\n=\nprintf '\2\\n' >> \1\n\n\n=g" |
      sed -z "s=\n\n*=\n=g; s=\([^']\)\nend=\1\n\nend=g"
)"

Open in Gitpod

adomani avatar Jul 03 '24 06:07 adomani

PR summary b600a781ce

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ endOfLinter + getLinterHash

You can run this locally as follows
## summary with just the declaration names:
./scripts/no_lost_declarations.sh short <optional_commit>

## more verbose report:
./scripts/no_lost_declarations.sh <optional_commit>

github-actions[bot] avatar Jul 03 '24 07:07 github-actions[bot]

#14620 contains a few of these fixes. As discussed with adomani, let's land these fixes as a follow-up, and land the linter now.

grunweg avatar Jul 10 '24 16:07 grunweg

🚀 Pull request has been placed on the maintainer queue by grunweg.

github-actions[bot] avatar Jul 10 '24 16:07 github-actions[bot]

What sort of linter is this? (syntax? environment? script?) I can't even find it amongst all the modified files. :-(

I think we need to split out the actual section closing updates from the PR that adds the linter.

kim-em avatar Jul 10 '24 16:07 kim-em

It's a syntax linter; it can be found in Mathlib/Tactic/Linter/Lint.lean.

grunweg avatar Jul 10 '24 16:07 grunweg

Created #14621 with just the newly added sections/namespaces.

grunweg avatar Jul 10 '24 16:07 grunweg

The fixes to the other files have landed; I have merged master. This PR now just contains the linter. I still think the implementation is good. maintainer merge

grunweg avatar Jul 10 '24 22:07 grunweg

🚀 Pull request has been placed on the maintainer queue by grunweg.

github-actions[bot] avatar Jul 10 '24 22:07 github-actions[bot]

Build failed (retrying...):

mathlib-bors[bot] avatar Jul 11 '24 13:07 mathlib-bors[bot]

Build failed (retrying...):

mathlib-bors[bot] avatar Jul 11 '24 14:07 mathlib-bors[bot]

bors r-

mattrobball avatar Jul 11 '24 14:07 mattrobball

Canceled.

mathlib-bors[bot] avatar Jul 11 '24 14:07 mathlib-bors[bot]

Wronskian violates the linter and just got in

mattrobball avatar Jul 11 '24 14:07 mattrobball

bors delegate+

Please merge again when fixed

mattrobball avatar Jul 11 '24 14:07 mattrobball

:v: adomani can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

mathlib-bors[bot] avatar Jul 11 '24 14:07 mathlib-bors[bot]

bors r+

adomani avatar Jul 11 '24 14:07 adomani

Pull request successfully merged into master.

Build succeeded:

mathlib-bors[bot] avatar Jul 11 '24 15:07 mathlib-bors[bot]