blob: 01e1e1272b3ce7e77acbf6ddebdea9f672340158 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# Contributing to Diplonat
## Development guidelines
### Code formatting
[Our CI pipeline](./.drone.yml) features a verification of the code format, using [rustfmt](https://github.com/rust-lang/rustfmt).
#### Installing rustfmt
You must install a very recent version of `rustfmt` through rust nightly
To install:
```
rustup toolchain install nightly-x86_64-unknown-linux-gnu
rustup component add rustfmt --toolchain nightly
```
#### Usage
To run on Diplonat, launch the following in the root directory:
```
cargo +nightly fmt
```
This will format the whole repository using the settigs defined in [`.rustfmt.toml`](./.rustfmt.toml).
#### Auto-format code
You can automate formatting in a number of ways:
[Setup your IDE to use `rustfmt`](https://github.com/rust-lang/rustfmt#running-rustfmt-from-your-editor).
Setup a git hook to run `rustfmt` before each commit:
```bash
cat <<EOF > .git/hooks/pre-commit
#!/bin/bash
cargo +nightly fmt
EOF
chmod +x .git/hooks/pre-commit
```
|