Skip to content

Commit

Permalink
Do not suggest adding clippy to git hooks
Browse files Browse the repository at this point in the history
Signed-off-by: Jacinta Ferrant <[email protected]>
  • Loading branch information
jferrant committed Jan 22, 2025
1 parent 728e4d2 commit 0c1059c
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,18 @@ fix: incorporate unlocks in mempool admitter, #3623

### Recommended githooks

It is helpful to set up the pre-commit git hook set up, so that Rust formatting issues and clippy warnings are caught before
It is helpful to set up the pre-commit git hook set up, so that Rust formatting issues are caught before
you push your code. Follow these instruction to set it up:

1. Rename `.git/hooks/pre-commit.sample` to `.git/hooks/pre-commit`
2. Change the content of `.git/hooks/pre-commit` to be the following

```sh
#!/bin/sh
# Format staged Rust files
git diff --name-only --staged | grep '\.rs$' | xargs -P 8 -I {} rustfmt {} --edition 2021 --check --config group_imports=StdExternalCrate,imports_granularity=Module || (
echo 'rustfmt failed: run "cargo fmt-stacks"';
exit 1
)
# Run cargo clippy-stacks and fail the commit if there are any warnings
if ! cargo clippy-stacks; then
echo 'cargo clippy-stacks failed: fix the warnings and try again.';
exit 1
fi
```

3. Make it executable by running `chmod +x .git/hooks/pre-commit`
Expand Down

0 comments on commit 0c1059c

Please sign in to comment.