Skip to content

[Merged by Bors] - feat: rewrite the duplicateImports linter - #17555

Closed
grunweg wants to merge 22 commits into
masterfrom
MR-duplicate-imports
Closed

grunweg wants to merge 22 commits into
masterfrom
MR-duplicate-imports

Conversation

@grunweg

@grunweg grunweg commented Oct 8, 2024 •

Copy link
Copy Markdown
Contributor

as part of the header linter. This yields better error spans, is more robust (as it avoids false positives from text-based parsing) and yields results more quickly (providing a better user experience).

Also rewrite the broadImports linter to log warnings directly, as opposed to passing them down to the headerLinter and logging them there.


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 df03aee705

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Tactic.Linter.TextBased 20 19 -1 (-5.00%)
Import changes for all files
Files Import difference
Mathlib.Tactic.Linter.TextBased -1

Declarations diff

+ duplicateImportsCheck
- duplicateImportsLinter

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.

@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Oct 8, 2024
Comment thread Mathlib/Tactic/Linter/Header.lean Resolved
Comment thread Mathlib/Tactic/Linter/Header.lean Resolved
@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
@grunweg
grunweg force-pushed the MR-duplicate-imports branch from 4c4ca94 to a557669 Compare October 16, 2024 07:20
@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
@grunweg
grunweg force-pushed the MR-duplicate-imports branch from 111d67a to 2b602b7 Compare October 16, 2024 07:27
@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

@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.

Thanks! I'll take a closer look, but I can't right now!

Comment thread Mathlib/Tactic/Linter/Header.lean Resolved
Comment thread Mathlib/Tactic/Linter/Header.lean Resolved
Comment thread Mathlib/Tactic/Linter/Header.lean Resolved
@adomani

adomani commented Oct 16, 2024

Copy link
Copy Markdown
Contributor

Now that both these checks loop separately over all imports, maybe we can even unify them into a single loop that checks both broad and duplicate imports... Sorry for not thinking about this earlier!

@grunweg

grunweg commented Oct 17, 2024

Copy link
Copy Markdown
Contributor Author

I see where you're coming from - but in the medium term, I view these linters as sufficiently different that combining them does not feel as helpful. For instance, after #14898 the two functions will have different signatures...

@grunweg

grunweg commented Oct 17, 2024

Copy link
Copy Markdown
Contributor Author

I'm puzzled by the test failure - I have no idea where the extra warning with line numbers is coming from. @damiano Do you have any ideas?

@adomani

adomani commented Oct 17, 2024

Copy link
Copy Markdown
Contributor

It looks like the warning about importing the Tactic folder is out-of-place. Can you check? I cannot get a working cache.

@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 24, 2024
@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 27, 2024
@grunweg

grunweg commented Oct 27, 2024

Copy link
Copy Markdown
Contributor Author

I just merged master. @adomani Let me know if you prefer me to split this PR in two, one for rewriting the broadImports linter to log warnings directly, and another for rewriting this linter.

@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 31, 2024
@leanprover-community-bot-assistant leanprover-community-bot-assistant added merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) and removed merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) labels Nov 2, 2024
@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot added blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) and removed blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) labels Nov 4, 2024
@leanprover-community-bot-assistant leanprover-community-bot-assistant removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 4, 2024

@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.

Thanks! Just a couple of minor wording suggestions.

maintainer merge

Comment thread Mathlib/Tactic/Linter/Header.lean Resolved
Comment thread Mathlib/Tactic/Linter/Header.lean Resolved
Comment thread Mathlib/Tactic/Linter/Header.lean Resolved
@github-actions

github-actions Bot commented Nov 4, 2024

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 Nov 4, 2024
@bryangingechen

Copy link
Copy Markdown
Contributor

Thanks!
bors r+

@github-actions github-actions Bot added the ready-to-merge This PR has been sent to bors. label Nov 7, 2024
mathlib-bors Bot pushed a commit that referenced this pull request Nov 7, 2024
as part of the header linter. This yields better error spans, is more robust (as it avoids false positives from text-based parsing) and yields results more quickly (providing a better user experience).

Also rewrite the `broadImports` linter to log warnings directly, as opposed to passing them down to the `headerLinter` and logging them there.



Co-authored-by: grunweg <[email protected]>
Co-authored-by: adomani <[email protected]>
@mathlib-bors

mathlib-bors Bot commented Nov 7, 2024

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title feat: rewrite the duplicateImports linter [Merged by Bors] - feat: rewrite the duplicateImports linter Nov 7, 2024
@mathlib-bors mathlib-bors Bot closed this Nov 7, 2024
@mathlib-bors
mathlib-bors Bot deleted the MR-duplicate-imports branch November 7, 2024 03:51
TobiasLeichtfried pushed a commit that referenced this pull request Nov 21, 2024
as part of the header linter. This yields better error spans, is more robust (as it avoids false positives from text-based parsing) and yields results more quickly (providing a better user experience).

Also rewrite the `broadImports` linter to log warnings directly, as opposed to passing them down to the `headerLinter` and logging them there.



Co-authored-by: grunweg <[email protected]>
Co-authored-by: adomani <[email protected]>
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.

5 participants