35 lines
1.5 KiB
Markdown
35 lines
1.5 KiB
Markdown
# 094 — Adopt rustfmt and format the codebase
|
|
|
|
## Summary
|
|
|
|
The Rust backend has no `rustfmt.toml` and isn't currently formatted
|
|
to rustfmt's defaults: `cargo fmt -- --check` exits non-zero, reporting
|
|
diffs across 24 files (352 diff hunks total).
|
|
|
|
## Where
|
|
|
|
- No `rustfmt.toml` / `.rustfmt.toml` exists at the repo root.
|
|
- `cargo fmt -- --check` reports diffs in `src/api/{dto,mcp_server,mod}.rs`,
|
|
`src/cli/{mod,sessions}.rs`, `src/config/{mod,profile}.rs`, and most
|
|
of `src/engine/**` (`alerts.rs`, `data_value.rs`, `filter_datetime.rs`,
|
|
`filter_parser.rs`, `ingest.rs`, `logfmt.rs`, `message.rs`, `mod.rs`,
|
|
`promql.rs`, `rate.rs`, `snapshot/{filter,metrics,mod,params,query,sort}.rs`,
|
|
`tests.rs`). Heaviest: `src/engine/snapshot/mod.rs` (~65 hunks),
|
|
`src/config/profile.rs` (~38), `src/api/mod.rs` (~35),
|
|
`src/engine/alerts.rs` (~28).
|
|
- `Makefile:26` (`lint-be`) currently only runs `cargo clippy
|
|
--all-targets` — no `cargo fmt --check` step.
|
|
|
|
## Scope
|
|
|
|
- Add a `rustfmt.toml` if any defaults should be overridden (otherwise
|
|
an empty/absent file is fine and rustfmt defaults apply — decide
|
|
whether to keep the file empty for documentation purposes or omit
|
|
it).
|
|
- Run `cargo fmt` across the whole `src/` tree as a single,
|
|
non-functional formatting commit (don't mix with logic changes, to
|
|
keep the diff reviewable and `git blame`-friendly).
|
|
- Add a `cargo fmt --check` step to `make lint` (or a new `make
|
|
fmt-check` wired into CI) so future changes can't drift out of
|
|
format again.
|