Skip to content
This repository was archived by the owner on May 3, 2022. It is now read-only.

Commit d35ad8a

Browse files
definitelynobodyNick Vidal
authored andcommitted
Add documentation on setting up a pre-push hook.
1 parent d5b38fd commit d35ad8a

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

docs/Contributing/Git-hook.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Git hook
2+
3+
This is a simple script that will run linting and formatting checks when you run `git push`.
4+
5+
*NOTE*: This is an optional step! It's valid to run these checks in some other way.
6+
7+
To install the hook paste the following into `.git/hooks/pre-push`:
8+
9+
```
10+
#!/bin/sh
11+
set -xe
12+
13+
# Run linting checks (not completely exhaustive)
14+
cargo clippy --all-features --manifest-path=Cargo.toml -- -D warnings
15+
16+
if [ -d "internal" ]; then
17+
cargo clippy --target=x86_64-unknown-linux-musl --all-features --manifest-path=internal/shim-sgx/Cargo.toml -- -D warnings
18+
cargo clippy --target=x86_64-unknown-linux-musl --all-features --manifest-path=internal/shim-sev/Cargo.toml -- -D warnings
19+
cargo clippy --target=x86_64-unknown-linux-musl --all-features --manifest-path=internal/wasmldr/Cargo.toml -- -D warnings
20+
fi
21+
22+
# Run formatting tests
23+
cargo fmt -- --check
24+
25+
if [ -d "internal" ]; then
26+
cargo fmt --manifest-path=internal/shim-sgx/Cargo.toml -- --check
27+
cargo fmt --manifest-path=internal/shim-sev/Cargo.toml -- --check
28+
cargo fmt --manifest-path=internal/wasmldr/Cargo.toml -- --check
29+
fi
30+
31+
exit 0
32+
```
33+
34+
You can skip running this check with:
35+
36+
```sh
37+
git push --no-verify
38+
```

sidebars.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const sidebars = {
3131
{
3232
type: 'category',
3333
label: 'Contributing Guide',
34-
items: ['Contributing/Introduction','Contributing/Onboarding','Contributing/Code','Contributing/Coding-Style','Contributing/PRs','Contributing/Issues','Contributing/RFCs','Contributing/Docs','Contributing/Outreach','Contributing/Lab'],
34+
items: ['Contributing/Introduction','Contributing/Onboarding','Contributing/Code','Contributing/Coding-Style','Contributing/Git-hook','Contributing/PRs','Contributing/Issues','Contributing/RFCs','Contributing/Docs','Contributing/Outreach','Contributing/Lab'],
3535
},
3636
{
3737
type: 'category',

0 commit comments

Comments
 (0)