Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

refactor(scripts/mk_nolint): produce nolints.txt file during linting#2194

Merged
mergify[bot] merged 16 commits into
masterfrom
parlint
Mar 21, 2020
Merged

refactor(scripts/mk_nolint): produce nolints.txt file during linting#2194
mergify[bot] merged 16 commits into
masterfrom
parlint

Conversation

@gebner
Copy link
Copy Markdown
Member

@gebner gebner commented Mar 19, 2020

This changes linting in the following way:

  1. Linters are executed in parallel. Unfortunately I don't think we can execute the linter for each declaration in parallel, because spawning tasks is a bit slow in Lean 3 (see comment in list.mmap_async). There is a bug in Lean.
  2. The nolints.txt file is generated directly during the linting step.

Before this PR, we ran the all the linters twice. Once to to produce the warnings and fail CI, and then to update the nolints.txt file. Therefore the linting steps in CI on the master branch take about 50 minutes. After this PR, we only run the linters one and furthermore in parallel as well. I hope that linting will now in total only take ~15 minutes or so.

The last few commits in this PR test two things in the CI setup:

  1. Whether CI fails if there are linting errors. This is the "Make linter fail." commit.
  2. Whether the nolints.txt file is updated correctly. This is the "Remove one line from nolints.txt" commit. The linting step runs git diff to show the changes, so we can check this even on a PR build.

The git commit step could still fail on master, so we need to keep an eye out for that eventuality.

TO CONTRIBUTORS:

Make sure you have:

  • reviewed and applied the coding style: coding, naming
  • reviewed and applied the documentation requirements
  • for tactics:
  • make sure definitions and lemmas are put in the right files
  • make sure definitions and lemmas are not redundant

If this PR is related to a discussion on Zulip, please include a link in the discussion.

For reviewers: code review check list

@gebner
Copy link
Copy Markdown
Member Author

gebner commented Mar 19, 2020

See #2170 (comment) for more motivation.

@gebner
Copy link
Copy Markdown
Member Author

gebner commented Mar 19, 2020

So apparently lean segfaults now... And I can't debug it because CI doesn't upload oleans for branches that have been updated since. (Ok, I know just have to wait but I'm impatient.)

@gebner gebner changed the title refactor(scripts/mk_nolint): lint in parallel and produce nolints.txt file during linting refactor(scripts/mk_nolint): produce nolints.txt file during linting Mar 19, 2020
@gebner
Copy link
Copy Markdown
Member Author

gebner commented Mar 19, 2020

So the parallelization code triggers a Lean bug: leanprover-community/lean#151

I've removed that part. Now the PR only combines the nolints.txt generation with the normal linting step.

@cipher1024 cipher1024 requested a review from robertylewis March 20, 2020 04:48
@gebner
Copy link
Copy Markdown
Member Author

gebner commented Mar 20, 2020

CI fails as expected when there's a linting error: https://github.com/leanprover-community/mathlib/runs/520528765

The nolints.txt file is also updated as expected.

The only thing that could fail after merging to master is the git commit step, though I tried to be careful.

Comment thread scripts/lint_mathlib.lean Outdated
Copy link
Copy Markdown
Member

@robertylewis robertylewis left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! Looks generally good to me. We can add the parallel part back in if/when the Lean bug gets fixed.

Comment thread src/tactic/lint.lean Outdated
Comment thread src/tactic/lint.lean Outdated
Comment thread scripts/lint_mathlib.lean Outdated
@robertylewis robertylewis added the ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) label Mar 21, 2020
@mergify mergify Bot merged commit 0bd8b94 into master Mar 21, 2020
@bryangingechen bryangingechen deleted the parlint branch March 30, 2020 02:24
cipher1024 pushed a commit that referenced this pull request Apr 20, 2020
…2194)

* Factor out code to determine automatically-generated declarations.

* Mark bool.decidable_eq and decidable.to_bool as [inline]

* Execute linters in parallel.

* Add lint_mathlib.lean script.

* Switch CI to new lint_mathlib.lean script.

* Make linter fail.

* Revert "Make linter fail."

This reverts commit 8b509c5.

* Remove one line from nolints.txt

* Change shebang in rm_all.sh to be nixos-compatible

* Disable parallel checking.

* Make linter fail.

* Revert "Make linter fail."

This reverts commit 8f5ec62.

* Move is_auto_decl to meta/expr.lean

* Remove list.mmap_async

* Factor out name.from_string

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
butterthebuddha pushed a commit to butterthebuddha/mathlib that referenced this pull request May 15, 2020
…eanprover-community#2194)

* Factor out code to determine automatically-generated declarations.

* Mark bool.decidable_eq and decidable.to_bool as [inline]

* Execute linters in parallel.

* Add lint_mathlib.lean script.

* Switch CI to new lint_mathlib.lean script.

* Make linter fail.

* Revert "Make linter fail."

This reverts commit 8b509c5.

* Remove one line from nolints.txt

* Change shebang in rm_all.sh to be nixos-compatible

* Disable parallel checking.

* Make linter fail.

* Revert "Make linter fail."

This reverts commit 8f5ec62.

* Move is_auto_decl to meta/expr.lean

* Remove list.mmap_async

* Factor out name.from_string

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
butterthebuddha pushed a commit to butterthebuddha/mathlib that referenced this pull request May 16, 2020
…eanprover-community#2194)

* Factor out code to determine automatically-generated declarations.

* Mark bool.decidable_eq and decidable.to_bool as [inline]

* Execute linters in parallel.

* Add lint_mathlib.lean script.

* Switch CI to new lint_mathlib.lean script.

* Make linter fail.

* Revert "Make linter fail."

This reverts commit 8b509c5.

* Remove one line from nolints.txt

* Change shebang in rm_all.sh to be nixos-compatible

* Disable parallel checking.

* Make linter fail.

* Revert "Make linter fail."

This reverts commit 8f5ec62.

* Move is_auto_decl to meta/expr.lean

* Remove list.mmap_async

* Factor out name.from_string

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants