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

Chore/add clippy-stacks alias #5734

Merged
merged 7 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[alias]
stacks-node = "run --package stacks-node --"
fmt-stacks = "fmt -- --config group_imports=StdExternalCrate,imports_granularity=Module"
clippy-stacks = "clippy -p libstackerdb -p stacks-signer -p pox-locking -p clarity -p libsigner -p stacks-common --no-deps --tests --all-features -- -D warnings"

# Uncomment to improve performance slightly, at the cost of portability
# * Note that native binaries may not run on CPUs that are different from the build machine
Expand Down
15 changes: 1 addition & 14 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,8 @@ jobs:
name: Clippy Check
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Define Rust Toolchain
id: define_rust_toolchain
run: echo "RUST_TOOLCHAIN=$(cat ./rust-toolchain)" >> $GITHUB_ENV
- name: Setup Rust Toolchain
id: setup_rust_toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: clippy
- name: Clippy
id: clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -p libstackerdb -p stacks-signer -p pox-locking -p clarity -p libsigner -p stacks-common --no-deps --tests --all-features -- -D warnings
alias: "clippy-stacks"
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,18 @@ You can automatically reformat your commit via:
cargo fmt-stacks
```

## Clippy Warnings

PRs will be checked against `clippy` and will _fail_ if any clippy warnings are generated.
Unfortunately, not all existing clippy warnings have been addressed throughout stacks-core, so arguments must be passed via the command line.
Therefore, we handle `clippy` configurations using a Cargo alias: `cargo clippy-stacks`

You can check what warnings need to be addressed locally via:

```bash
cargo clippy-stacks
```

## Comments

Comments are very important for the readability and correctness of the codebase. The purpose of comments is:
Expand Down
Loading