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

Clippy is not run on all workspaces in CI #23538

Closed
jackcmay opened this issue Mar 8, 2022 · 1 comment · Fixed by #23599
Closed

Clippy is not run on all workspaces in CI #23538

jackcmay opened this issue Mar 8, 2022 · 1 comment · Fixed by #23599

Comments

@jackcmay
Copy link
Contributor

jackcmay commented Mar 8, 2022

Problem

The Solana repository contains multiple workspaces, but Clippy is run only on the top-level workspace. This could cause important bugs to be missed.

The line in ci/test-checks.sh that runs Clippy appears in figure 13.1. A potential modification to run it on all workspaces appears in
figure 13.2. Running the modified command produces additional warnings. An example appears in figure 13.3.

   _ "$cargo" nightly clippy -Zunstable-options --workspace --all-targets --
--deny=warnings --deny=clippy::integer_arithmetic

Figure 13.1: solana/ci/test-checks.sh#L70

grep -r -I -l '^\[workspace\]$' --include=Cargo.toml |
while read X; do
  _ "$cargo" nightly clippy -Zunstable-options --workspace --all-targets
--manifest-path="$X" -- --deny=warnings --deny=clippy::integer_arithmetic
done

Figure 13.2: Potential modification to the command in figure 13.1

error: integer arithmetic detected
  --> rust/realloc/src/instructions.rs:22:5
   |
22 |     *bump += 1;
   |     ^^^^^^^^^^
   |
   = note: requested on the command line with `-D clippy::integer-arithmetic`
   = help: for further information visit
https://rust-lang.github.io/rust-clippy/master/index.html#integer_arithmetic

Figure 13.3: Example warning produced when the command in figure 13.2 is run

Proposed Solution

Short term, ensure that Clippy is run on all workspaces in CI. Clippy is an invaluable tool for exposing bugs and problematic coding patterns. Running it on all workspaces will improve Clippy’s effectiveness at exposing bugs in Solana.

Long term, when problematic code patterns are discovered, check whether they are caught by an existing Clippy lint. Doing so will help to verify that Clippy is being run on all code for which it is intended.

@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any activity in past 7 days after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant