Skip to content

[Merged by Bors] - feat: remove the text-based linters for module docstring, copyright and author lines - #17556

Closed
grunweg wants to merge 3 commits into
masterfrom
MR-rewrite-header
Closed

grunweg wants to merge 3 commits into
masterfrom
MR-rewrite-header

Conversation

@grunweg

@grunweg grunweg commented Oct 8, 2024 •

Copy link
Copy Markdown
Contributor

They are superseded by the header linter (#16574).


Open in Gitpod

@grunweg grunweg added the t-linter Linter label Oct 8, 2024
@github-actions github-actions Bot added the large-import Automatically added label for PRs with a significant increase in transitive imports label Oct 8, 2024
@github-actions

github-actions Bot commented Oct 8, 2024 •

Copy link
Copy Markdown

PR summary 5291bffc22

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

- broadImportsLinter
- copyrightHeaderLinter
- import_only_check(lines,
- isCorrectAuthorsLine
- regular_check(lines,

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 script/declarations_diff.sh contains some details about this script.

@grunweg grunweg added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Oct 9, 2024
@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot removed the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Oct 16, 2024
@leanprover-community-bot-assistant leanprover-community-bot-assistant added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 16, 2024
@github-actions github-actions Bot removed the large-import Automatically added label for PRs with a significant increase in transitive imports label Oct 16, 2024
…nd author lines

They are superseded by the header linter.

Also simplify lint-style.py accordingly, and
remove no longer necessary entries in nolints-style.
@grunweg grunweg removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 16, 2024
@grunweg

grunweg commented Oct 16, 2024

Copy link
Copy Markdown
Contributor Author

@adomani Would you like to review this removal PR? (I am fine with waiting for a few days to land this, out of prudence.)

@bryangingechen bryangingechen self-assigned this Oct 16, 2024
@urkud

urkud commented Oct 17, 2024

Copy link
Copy Markdown
Member

I suggest an experiment: add a file that breaks the rules and see that the new linter actually catches the errors. But probably people who are more involved in CI and metaprogramming have better ideas.

@grunweg

grunweg commented Oct 17, 2024

Copy link
Copy Markdown
Contributor Author

I just added such a file, the linter works locally. Does that look sufficient to you? (If CI fails, I'll remove it again.)

@adomani

adomani commented Oct 17, 2024 •

Copy link
Copy Markdown
Contributor

The internal logic of the headerLinter is tested in test/HeaderLinter.lean. The linter picked up non-complying copyright headers in development and I also think that I did a test similar to the one that Michael just did while developing the linter.

The test here also seems to work: besides the fact that the "new" definition does not have a doc-string, there are also build errors coming from the malformed copyright header.

My main reason for not being immediately enthusiastic about removing these "text-based" linters is that the syntax linter will typically lint Mathlib.Init and whatever imports that, but the text-based ones also cover the "early" files.

@grunweg

grunweg commented Oct 17, 2024 •

Copy link
Copy Markdown
Contributor Author

Wasn't the point of Mathlib.Init that every file imports it (or is imported in it)?
Checking the copyright headers of all these syntax linters is nice, I agree - but I don't think keeping a separate linter implementation around just for them is an appropriate cost-benefit ratio.

Especially since my not-so-secret medium-term plan is to remove lint-style.py entirely; this is one of the blockers towards that.

@adomani

adomani commented Oct 17, 2024

Copy link
Copy Markdown
Contributor

Right, I simply have not yet accepted that the style-linters will not necessarily by style-compliant, that's all! I agree that having as much as possible enforced in Lean is a good aim: once CI is happy, I am happy to maintainer merge this PR!

@grunweg

grunweg commented Oct 17, 2024

Copy link
Copy Markdown
Contributor Author

I share your wish that these files should be style-compliant!
For these particular linters, that should not be too hard to enforce by hand, though... in practice, these seem to be violated out of ignorance more than anything else.

@adomani adomani left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

I see that Bryan self-assigned this PR, so I won't maintainer merge, in case he wants to add something, but I am happy with merging it!

Thanks!

grunweg added a commit that referenced this pull request Oct 27, 2024
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.
@grunweg

grunweg commented Oct 27, 2024

Copy link
Copy Markdown
Contributor Author

@adomani I just wrote #18725, importing the header linter in every file that is imported in Mathlib.Init. This should ensure all files are checked for missing copyright (or module doc-string). Does that assugae your concerns on this PR?

@adomani

adomani commented Oct 31, 2024

Copy link
Copy Markdown
Contributor

This is what was going to happen once the linter had been rewritten as a syntax linter, isn't it? 😉

I'll

maintainer merge

and also ping @bryangingechen, in case there are any last-minute comments!

@github-actions

Copy link
Copy Markdown

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

@github-actions github-actions Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Oct 31, 2024
@bryangingechen

Copy link
Copy Markdown
Contributor

LGTM, thanks for the ping!
bors r+

@github-actions github-actions Bot added the ready-to-merge This PR has been sent to bors. label Oct 31, 2024
mathlib-bors Bot pushed a commit that referenced this pull request Oct 31, 2024
…nd author lines (#17556)

They are superseded by the header linter (#16574).
@mathlib-bors

mathlib-bors Bot commented Oct 31, 2024

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title feat: remove the text-based linters for module docstring, copyright and author lines [Merged by Bors] - feat: remove the text-based linters for module docstring, copyright and author lines Oct 31, 2024
@mathlib-bors mathlib-bors Bot closed this Oct 31, 2024
@mathlib-bors
mathlib-bors Bot deleted the MR-rewrite-header branch October 31, 2024 14:45
grunweg added a commit that referenced this pull request Nov 2, 2024
…nd author lines (#17556)

They are superseded by the header linter (#16574).
mathlib-bors Bot pushed a commit that referenced this pull request Nov 4, 2024
…it (#18275)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. ready-to-merge This PR has been sent to bors. t-linter Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants