## Local development
>
> ⓘ **Info**
>
> <!-- cSpell:disable -->
> This repository strive to follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). Please follow them 😊
> Conventional commits will be parsed with [`git-cliff`](https://git-cliff.org/) to auto-generate `CHANGELOG.md` file.
>
To run tasks in this repository it is necessary to install [rust](https://www.rust-lang.org/) using the following command on Unix:
```shell
# unix
or follow the instructions on the [official page](https://forge.rust-lang.org/infra/other-installation-methods.html#rustup) to install on Windows.
In addition, please install also the following `cargo` plugins:
```shell
cargo install --force cargo-release git-cliff
```
which will help execute tasks such as tagging a new version of the library.
### Development Requirements
- Rust v1.88
- at least a basic knowledge of how to develop with Rust
### Building
To build this project it is enough to run the following command:
```shell
cargo build
```
### Testing
Since this project is a library, only unit-tests are provided. To run them, please launch the following command:
```shell
cargo test --lib
```
### Linting
Linting of project code is performed using `rustfmt` with a customized _nightly_ rule for imports and [`clippy`](https://github.com/rust-lang/rust-clippy). Consequently,
it is necessary to install Rust nightly channel:
```shell
rustup toolchain install nightly
```
and introduce `clippy` as an additional component to the toolchains:
```shell
rustup component add clippy
```
Afterward, it is possible to lint the project with the following commands:
```shell
cargo +nightly fmt --check
cargo clippy --all-targets --all-features
```
---
When using VSCode as editor, we recommend enabling `clippy` as project linter, to get
its warning displayed directly in the editor. This can be achieved by adding this configuration in `.vscode/settings.json` file:
```json
{
...,
"rust-analyzer.check.command": "clippy"
}
```
### Releasing
To create a new version of the service, it is recommended to leverage [`cargo-release`](https://github.com/crate-ci/cargo-release).
```shell
For example, the command below creates a new `patch` tag:
```shell
cargo release patch -p secret_rs --execute
```
which it is recommended to then push to the git server.
### Documentation
To view the Rust documentation for this project is possible to execute the following command:
```shell
cargo doc --all-features --open
```