Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lintcheck: clippy fixes, test on ci #6829

Closed
wants to merge 14 commits into from

Conversation

matthiaskrgr
Copy link
Member

fixes clippy warnings in lintcheck and adds a small test (run on 3 small crates) to gha ci

changelog: none

@rust-highfive
Copy link

r? @Manishearth

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Mar 2, 2021
@matthiaskrgr
Copy link
Member Author

r? @camsteffen or @flip1995

@flip1995
Copy link
Member

flip1995 commented Mar 2, 2021

The Clippy Dev workflow hasn't installed rustc-dev-preview.

@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Mar 2, 2021

Mmh... I removed the step that replaces the rust-toolchain file with the toolchain action because I actually need to build and run clippy during the lintcheck test and it needs a matching (none-"nightly") version.

I don't think I can make the toolchain action use the pinned nightly somehow for installing rustfmt...?

@matthiaskrgr matthiaskrgr force-pushed the lintcheck_unclippy branch 3 times, most recently from 70176c4 to d2a9917 Compare March 2, 2021 20:58
@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Mar 2, 2021

Ok, I think this works now:

We first remove the rust-toolchain file and grab an independent rustfmt version to check the formatting.
Then we restore the toolchain file via git and build clippy with the pinned nightly version (as part of the test, running lintcheck afterwards)

@matthiaskrgr
Copy link
Member Author

@bors try

just to be sure...

bors added a commit that referenced this pull request Mar 2, 2021
lintcheck: clippy fixes, test on ci

fixes clippy warnings in lintcheck and adds a small test (run on 3 small crates) to gha ci

changelog: none
@bors
Copy link
Collaborator

bors commented Mar 2, 2021

⌛ Trying commit d2a9917 with merge 676e913...

@bors
Copy link
Collaborator

bors commented Mar 2, 2021

☀️ Try build successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Build commit: 676e913 (676e9136093fc83ca6feb368f859ae7cfc7a26b7)

@flip1995
Copy link
Member

flip1995 commented Mar 2, 2021

WDYT about making a new workflow to check lintcheck and only run it, if lintcheck.rs is changed?

@matthiaskrgr
Copy link
Member Author

if we only check lintcheck if lintcheck.rs is touched, we won't be able to find out when lintcheck breaks as it did when we had the [workspace]-related changes, which was my main motivation behind the test!

@flip1995
Copy link
Member

flip1995 commented Mar 2, 2021

Ah right, good point. CI changes LGTM then. Changes to lintcheck also seem to resolve almost all Clippy complaints. (I think the pedantic lints would still trigger on it though)

@matthiaskrgr
Copy link
Member Author

Didn't see any pedantic warnings with cargo run --bin cargo-clippy --manifest-path=rust-clippy/Cargo.toml -- -Wclippy::pedantic --features lintcheck

Comment on lines 44 to 46
# Restore the rust-toolchain-file
- name: Restore rust-toolchain-file
run: git checkout rust-toolchain
Copy link
Member

Choose a reason for hiding this comment

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

I would move this right before the lintcheck test. That way clippy_dev has to be only rebuild once.

Currently it is built three times:

  1. For rustfmt with +nightly
  2. For the other tests with +
  3. For lintcheck --feature lintcheck

Comment on lines 41 to 42
- name: Test fmt
run: cargo dev fmt --check
Copy link
Member

Choose a reason for hiding this comment

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

And this should stay where it currently is, so it can profit from the Build job.

@flip1995
Copy link
Member

flip1995 commented Mar 3, 2021

I just wonder if the lintcheck test should be moved to the Clippy workflow to not have to build clippy again.

@flip1995
Copy link
Member

flip1995 commented Mar 3, 2021

@bors try

(hijacking this PR to fix up the Clippy CI.)

bors added a commit that referenced this pull request Mar 3, 2021
lintcheck: clippy fixes, test on ci

fixes clippy warnings in lintcheck and adds a small test (run on 3 small crates) to gha ci

changelog: none
@bors
Copy link
Collaborator

bors commented Mar 3, 2021

⌛ Trying commit 24111ec with merge 8b67d89...

@flip1995
Copy link
Member

flip1995 commented Mar 3, 2021

Hmm.. I really don't like checking the lintcheck tool in CI. It will be compile-checked by dogfood, once this PR is done and I can continue to work on the dogfood fix. I don't think we should put 3-5min CI time on any workflow to run lintcheck tests though. Thoughts? @matthiaskrgr

@flip1995
Copy link
Member

flip1995 commented Mar 3, 2021

Also please review this commit: e465a8b

IIUC the --fix test only checks that the --fix command is working? In that case it shouldn't matter on which crate we run the test on.

matthiaskrgr and others added 14 commits March 4, 2021 08:52
Previously, we removed the rust-toolchain file in ci and that used the toolchain action to install rustfmt
and run `cargo dev fmt`.

For testing lintcheck however, we need the rust-toolchain file and a pinned nightly version to build clippy.

Solution:
First remove the rust-toolchain file and check the formatting.
Then restore the toolchain file from the git repo and run the other tests
Also -Zunstable-options isn't required anymore
It will be compile-checked by dogfood
@flip1995
Copy link
Member

flip1995 commented Mar 4, 2021

The lintcheck job took 2m52s, which is approximately the same amount of time, that I got yesterday while testing. I'm still not convinced that that is worth it, since it is compile-checked by dogfood anyway.

reformat clippy.ymk and clippy_bors.yml 458cf05

The previous formatting was done according to the examples in https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions. I don't think it makes a difference, so I think reformatting to a yaml style that feels more natural (IMO) should be fine.

@matthiaskrgr
Copy link
Member Author

I've split out the clippy lint fixes for lintcheck into #6839, I think there was something waiting on that?

I guess I'll then rework this branch to not test lintcheck on ci, sigh :/

bors added a commit that referenced this pull request Mar 4, 2021
lintcheck: fix clippy warnings

split out from #6829
changelog: none
@flip1995
Copy link
Member

flip1995 commented Mar 4, 2021

I think there was something waiting on that?

Yes my dogfood fix, thanks for splitting it out!

I guess I'll then rework this branch to not test lintcheck on ci, sigh :/

Sorry. I don't think 3min CI time is worth for testing lintcheck, since it is a rarely used dev-tool, I don't expect to break often, once it gets a bit more "stable". If I'm proven wrong in this regard, I'm of course happy to include it.

@bors
Copy link
Collaborator

bors commented Mar 4, 2021

☔ The latest upstream changes (presumably #6839) made this pull request unmergeable. Please resolve the merge conflicts.

@matthiaskrgr matthiaskrgr added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Mar 4, 2021
bors added a commit that referenced this pull request Mar 4, 2021
lintcheck: add test (but don't run on ci)

This is the rest of #6829 but without adding anything to ci

*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: none
@flip1995 flip1995 mentioned this pull request Mar 5, 2021
bors added a commit that referenced this pull request Mar 5, 2021
Dogfood and CI fixes

The CI fix is practically #6829 rebased and squashed into one commit

Dogfood fix is a follow up of #6802

r? `@matthiaskrgr` for lintcheck changes

(best reviewed with whitespace changes hidden)

changelog: none
bors added a commit that referenced this pull request Mar 5, 2021
Dogfood and CI fixes

The CI fix is practically #6829 rebased and squashed into one commit

Dogfood fix is a follow up of #6802

r? `@matthiaskrgr` for lintcheck changes

(best reviewed with whitespace changes hidden)

changelog: none
bors added a commit that referenced this pull request Mar 5, 2021
Dogfood and CI fixes

The CI fix is practically #6829 rebased and squashed into one commit

Dogfood fix is a follow up of #6802

r? `@matthiaskrgr` for lintcheck changes

(best reviewed with whitespace changes hidden)

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants