From 447221ca164596db225dafbaa878569ecb2cd072 Mon Sep 17 00:00:00 2001 From: Leonora Tindall Date: Wed, 2 Feb 2022 12:56:41 -0600 Subject: [PATCH] Add pre-push script for format and clippy --- readme.md | 10 ++++++++++ tools/prepush | 5 +++++ 2 files changed, 15 insertions(+) create mode 100755 tools/prepush diff --git a/readme.md b/readme.md index 80b3d0f..43c96f3 100644 --- a/readme.md +++ b/readme.md @@ -196,3 +196,13 @@ This pastebin: - uses server sided highlighting, which ensures that everything stays light and snappy at the client side. - uses very minimal frontend because a pastebin does not need it. It focuses (or atleast tries to) on getting things done in minimum amount of clicks. +## Hacking + +If you want to ensure your pushed refs will pass CI, add the prepush script to your Git hooks: + +```bash +$ cat tools/prepush >> .git/hooks/pre-push +``` + +Alternately, just run `./tools/prepush` yourself before pushing. + diff --git a/tools/prepush b/tools/prepush new file mode 100755 index 0000000..e33f5e0 --- /dev/null +++ b/tools/prepush @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +echo "[prepush] Running cargo fmt --check" +cargo fmt -- --check +echo "[prepush] Running cargo clippy" +cargo clippy -- -Dwarnings