2023-07-16 17:06:44 +00:00
|
|
|
# Development
|
|
|
|
|
2024-01-20 09:41:07 +00:00
|
|
|
Code style follows the `rustfmt.toml` file.
|
|
|
|
|
|
|
|
## Trace logs
|
|
|
|
|
|
|
|
Enable trace logs to `stderr` with:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
export MELI_DEBUG_STDERR=yes
|
|
|
|
```
|
|
|
|
|
|
|
|
This means you will have to to redirect `stderr` to a file like `meli 2> trace.log`.
|
|
|
|
|
|
|
|
Tracing is opt-in by build features:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
cargo build --features=debug-tracing,imap-trace,smtp-trace
|
|
|
|
```
|
|
|
|
|
2023-12-09 16:54:11 +00:00
|
|
|
## use `.git-blame-ignore-revs` file _optional_
|
|
|
|
|
|
|
|
Use this file to ignore formatting commits from `git-blame`.
|
|
|
|
It needs to be set up per project because `git-blame` will fail if it's missing.
|
|
|
|
|
|
|
|
```sh
|
|
|
|
git config blame.ignoreRevsFile .git-blame-ignore-revs
|
|
|
|
```
|
|
|
|
|
2024-01-20 09:41:07 +00:00
|
|
|
## Formatting with `rustfmt`
|
2023-07-16 17:06:44 +00:00
|
|
|
|
2024-01-20 09:41:07 +00:00
|
|
|
```sh
|
|
|
|
make fmt
|
|
|
|
```
|
|
|
|
|
|
|
|
## Linting with `clippy`
|
2023-07-16 17:06:44 +00:00
|
|
|
|
|
|
|
```sh
|
2024-01-20 09:41:07 +00:00
|
|
|
make lint
|
2023-07-16 17:06:44 +00:00
|
|
|
```
|
|
|
|
|
2024-01-20 09:41:07 +00:00
|
|
|
## Testing
|
2023-07-16 17:06:44 +00:00
|
|
|
|
|
|
|
```sh
|
2024-01-20 09:41:07 +00:00
|
|
|
make test
|
2023-07-16 17:06:44 +00:00
|
|
|
```
|
|
|
|
|
2024-01-20 09:41:07 +00:00
|
|
|
How to run specific tests:
|
2023-07-16 17:06:44 +00:00
|
|
|
|
2024-01-20 09:41:07 +00:00
|
|
|
```sh
|
|
|
|
cargo test -p {melib, meli} (-- --nocapture) (--test test_name)
|
|
|
|
```
|
|
|
|
|
|
|
|
## Profiling
|
2023-07-16 17:06:44 +00:00
|
|
|
|
|
|
|
```sh
|
2024-01-20 09:41:07 +00:00
|
|
|
perf record -g target/debug/meli
|
|
|
|
perf script | stackcollapse-perf | rust-unmangle | flamegraph > perf.svg
|
2023-07-16 17:06:44 +00:00
|
|
|
```
|
2024-01-20 09:41:07 +00:00
|
|
|
<!-- -->
|
|
|
|
<!-- ## Running fuzz targets -->
|
|
|
|
<!-- -->
|
|
|
|
<!-- Note: `cargo-fuzz` requires the nightly toolchain. -->
|
|
|
|
<!-- -->
|
|
|
|
<!-- ```sh -->
|
|
|
|
<!-- cargo +nightly fuzz run envelope_parse -- -dict=fuzz/envelope_tokens.dict -->
|
|
|
|
<!-- ``` -->
|