From 4efc6e1f2fedb785a8c6ed68d1c2c322bcf97005 Mon Sep 17 00:00:00 2001 From: Stephan Huber Date: Tue, 22 Oct 2024 22:04:22 +0200 Subject: [PATCH] chore: Use a pre-push hook to run fmt and clippy --- Cargo.lock | 7 +++++++ Cargo.toml | 14 ++++++++++++-- README.md | 4 ++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 81e2b01..a35cd59 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -399,6 +399,12 @@ version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" +[[package]] +name = "cargo-husky" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b02b629252fe8ef6460461409564e2c21d0c8e77e0944f3d189ff06c4e932ad" + [[package]] name = "cc" version = "1.1.24" @@ -2148,6 +2154,7 @@ dependencies = [ "base64 0.22.1", "bcrypt", "bollard", + "cargo-husky", "chrono", "clap", "clokwerk", diff --git a/Cargo.toml b/Cargo.toml index 057858f..f74bdbe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,6 +73,16 @@ path-clean = "1.0.1" bcrypt = "0.15.1" maplit = "1.0.2" +[dev-dependencies.cargo-husky] +version = "1" +default-features = false # Disable features which are enabled by default +features = [ + "prepush-hook", + "run-cargo-test", + "run-cargo-clippy", + "run-cargo-fmt", +] + [workspace.metadata.release] sign-tag = true pre-release-hook = [ @@ -90,10 +100,10 @@ pre-release-replacements = [ [workspace.metadata.cross.target.aarch64-unknown-linux-gnu] pre-build = [ "dpkg --add-architecture $CROSS_DEB_ARCH", - "apt-get update && apt-get --assume-yes install libssl-dev:$CROSS_DEB_ARCH" + "apt-get update && apt-get --assume-yes install libssl-dev:$CROSS_DEB_ARCH", ] [workspace.metadata.cross.target.x86_64-unknown-linux-gnu] pre-build = [ "dpkg --add-architecture $CROSS_DEB_ARCH", - "apt-get update && apt-get --assume-yes install libssl-dev:$CROSS_DEB_ARCH" + "apt-get update && apt-get --assume-yes install libssl-dev:$CROSS_DEB_ARCH", ] diff --git a/README.md b/README.md index 5cd0453..cb657b2 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,10 @@ and then start the server with cargo run --bin scotty or your preferred way to run a rust binary ``` +### Pre-push git hook via [cargo-husky](https://github.com/rhysd/cargo-husky) + +This project uses a pre-push git-hook installed by cargo husky. It shoud be installed automatically. + ### Updating the changelog We are using [git-cliff](https://git-cliff.org) to enforce a changelog. Please update the changelog with