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

Enforce no clippy warnings through CI #2148

Merged
merged 6 commits into from
Jul 26, 2021

Conversation

thomaseizinger
Copy link
Contributor

@thomaseizinger thomaseizinger commented Jul 20, 2021

Opened as a result of #2139.

Might also want to change the GitHub configuration to pervent merge if clippy fails.

@thomaseizinger thomaseizinger force-pushed the enforce-no-clippy-warnings branch from 91d0492 to 5bfc35e Compare July 20, 2021 01:29
@thomaseizinger thomaseizinger marked this pull request as ready for review July 20, 2021 01:29
Copy link
Member

@mxinden mxinden 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 tackling this @thomaseizinger. One small comment, other than that, this looks good to me.

@@ -152,8 +152,7 @@ jobs:
- name: Run cargo clippy
uses: actions-rs/cargo@v1.0.3
with:
command: clippy
args: -- -A clippy::type_complexity -A clippy::pedantic -A clippy::style
command: lint # cargo alias to allow reuse of config locally
Copy link
Member

Choose a reason for hiding this comment

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

Mhh, do I understand correctly that the alias would be needed to ease local development, in other words in order not to have to type clippy -- -A clippy::type_complexity -A clippy::pedantic -A clippy::style -D warnings before commiting? Though not particularly important, I don't think the additional convenience is worth the indirection, especially since I don't expect contributors to run into many clippy lints.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

since I don't expect contributors to run into many clippy lints.

The issue is that without specifying -A clippy::type_complexity -A clippy::pedantic -A clippy::style clippy returns something like 200 results for rust-libp2p :)

In case of a CI failure, users need to specify this entire configuration to reproduce the errors locally. Once clippy ships its configuration file, I think we should switch to that but until then, I see this alias as the best option we have to make fixing linting errors locally reasonably smooth.

Copy link
Member

Choose a reason for hiding this comment

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

👍 sounds good to me. Thanks for the additional reasoning.

I would just suggest renaming lint to something like custom-clippy or something along those lines.

@thomaseizinger thomaseizinger requested a review from mxinden July 26, 2021 08:55
Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Merci beaucoup!

@mxinden mxinden merged commit 7877929 into libp2p:master Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants