From bc8c87e08ca07dfec3a6cc00bb0488c1e24248c4 Mon Sep 17 00:00:00 2001 From: Deil Urba Date: Wed, 16 Oct 2024 13:00:13 +0100 Subject: [PATCH] chore(make): add clean, fmt, lint (#46) Add more `make` commands to clean, format and lint code easier. --- Makefile | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/Makefile b/Makefile index 0f87ba4..3ffe3b0 100644 --- a/Makefile +++ b/Makefile @@ -146,3 +146,67 @@ define docker_build_push --provenance=false \ --push endef + +##@ Other + +.PHONY: clean +clean: ## Perform a `cargo` clean and remove the binary directory. + cargo clean + rm -rf $(BIN_DIR) + +fmt: + cargo +nightly fmt + +lint-odyssey: + cargo +nightly clippy \ + --workspace \ + --bin "odyssey" \ + --lib \ + --tests \ + --benches \ + --features "$(FEATURES)" \ + -- -D warnings + +lint-other-targets: + cargo +nightly clippy \ + --workspace \ + --lib \ + --tests \ + --benches \ + --all-features \ + -- -D warnings + +lint: + make fmt && \ + make lint-odyssey && \ + make lint-other-targets + +fix-lint-odyssey: + cargo +nightly clippy \ + --workspace \ + --bin "odyssey" \ + --lib \ + --tests \ + --benches \ + --features "$(FEATURES)" \ + --fix \ + --allow-staged \ + --allow-dirty \ + -- -D warnings + +fix-lint-other-targets: + cargo +nightly clippy \ + --workspace \ + --lib \ + --tests \ + --benches \ + --all-features \ + --fix \ + --allow-staged \ + --allow-dirty \ + -- -D warnings + +fix-lint: + make fix-lint-odyssey && \ + make fix-lint-other-targets && \ + make fmt