forked from Deuxfleurs/diplonat
35 lines
804 B
Markdown
35 lines
804 B
Markdown
|
# 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 can run `rustfmt` with Rust 1.24 and above.
|
||
|
|
||
|
To install:
|
||
|
|
||
|
```
|
||
|
rustup component add rustfmt
|
||
|
```
|
||
|
|
||
|
#### Usage
|
||
|
|
||
|
To run on Diplonat, launch the following in the root directory:
|
||
|
|
||
|
```
|
||
|
cargo fmt --all
|
||
|
```
|
||
|
|
||
|
This will format the whole repository using the settigs defined in [`.rustfmt.toml`](./.rustfmt.toml): soft tabs of 2 spaces.
|
||
|
|
||
|
#### 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.
|