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

Add a set of standard clippy lints #10612

Closed
Kanabenki opened this issue Nov 17, 2023 · 5 comments
Closed

Add a set of standard clippy lints #10612

Kanabenki opened this issue Nov 17, 2023 · 5 comments
Labels
A-Build-System Related to build systems or continuous integration C-Code-Quality A section of code that is hard to understand or change C-Feature A new feature, making something new possible D-Trivial Nice and easy! A great choice to get started with Bevy

Comments

@Kanabenki
Copy link
Contributor

Kanabenki commented Nov 17, 2023

What problem does this solve or what need does it fill?

There's currently no project-level clippy lints defined.

What solution would you like?

Once #10011 is merged, we could expand the Cargo.toml lint table with a set of clippy lints we want to uphold through the codebase. Something we could use as inspiration is the set of clippy used in Embark projects. While some lints in it are probably too restrictive/opinionated, we could filter it and possibly check for additional lints that might fit the codebase in the full lint list.

We could then remove the few clippy warnings currently checked in CI, since they would be picked up from the lint table. This could be done over the course of several PRs since the resulting diff might be large.

What alternative(s) have you considered?

  • Keep the current setup as-is.
  • Just move the lints checked in CI to Cargo.toml.
@Kanabenki Kanabenki added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Nov 17, 2023
@alice-i-cecile alice-i-cecile added A-Build-System Related to build systems or continuous integration C-Code-Quality A section of code that is hard to understand or change and removed S-Needs-Triage This issue needs to be labelled labels Nov 17, 2023
@alice-i-cecile
Copy link
Member

For an initial PR, I'd like to do only those CI warnings we currently use.

Then, add one lint at a time in their own PRs. That will ensure each can be evaluated on its own, and reduce time-to-merge.

@Kanabenki
Copy link
Contributor Author

It could maybe be worth it to also add a .git-blame-ignore-revs to ignore clippy-related changes in the git blame (Github picks it up), since those might generated large diffs over time? Thought that would require merging the relevant PRs without squashing (or additional PRs just for that).

@alice-i-cecile
Copy link
Member

I think that's probably more complexity in the workflow than it's worth. Because this is a FOSS project with a huge range of contributors, we try to keep our project config and workflows simple where we can :)

@alice-i-cecile alice-i-cecile added the D-Trivial Nice and easy! A great choice to get started with Bevy label Nov 18, 2023
github-merge-queue bot pushed a commit that referenced this issue Nov 21, 2023
# Objective

Partially Addresses #10612

fix: add clippy::doc_markdown linting to cargo workspace

Rather than do all the warnings in `tools/ci/src/main.rs` in one-shot,
just wanted to have an initial pr adding the first one to get the form
correct as some may trigger build errors and require changes to get
merged more easily.

## Solution

- adding the doc_markdown and removing it from the ci check as it'll now
be a build error during normal compilation.

---------

Co-authored-by: François <mockersf@gmail.com>
AlexOkafor added a commit to AlexOkafor/bevy that referenced this issue Nov 21, 2023
github-merge-queue bot pushed a commit that referenced this issue Nov 28, 2023
# Objective

Partially addresses #10612
After moving the initial docs_markdown warning, this is a PR that moves
the rest of the CI clippy lint definitions to the cargo.toml.

## Solution

- the `tools/ci/src/main.rs` clippy lints removed and just the warning
flag remains.
- the warnings moved to the root cargo workspace toml.
github-merge-queue bot pushed a commit that referenced this issue Nov 28, 2023
# Objective

Related to #10612.

Enable the
[`clippy::manual_let_else`](https://rust-lang.github.io/rust-clippy/master/#manual_let_else)
lint as a warning. The `let else` form seems more idiomatic to me than a
`match`/`if else` that either match a pattern or diverge, and from the
clippy doc, the lint doesn't seem to have any possible false positive.

## Solution

Add the lint as warning in `Cargo.toml`, refactor places where the lint
triggers.
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this issue Jan 9, 2024
…#10640)

# Objective

Partially Addresses bevyengine#10612

fix: add clippy::doc_markdown linting to cargo workspace

Rather than do all the warnings in `tools/ci/src/main.rs` in one-shot,
just wanted to have an initial pr adding the first one to get the form
correct as some may trigger build errors and require changes to get
merged more easily.

## Solution

- adding the doc_markdown and removing it from the ci check as it'll now
be a build error during normal compilation.

---------

Co-authored-by: François <mockersf@gmail.com>
@james7132
Copy link
Member

What are the remaining items that aren't addressed on this issue?

@alice-i-cecile
Copy link
Member

Going to close as completed: new lints should have their own issues and PRs :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Build-System Related to build systems or continuous integration C-Code-Quality A section of code that is hard to understand or change C-Feature A new feature, making something new possible D-Trivial Nice and easy! A great choice to get started with Bevy
Projects
None yet
Development

No branches or pull requests

3 participants