From ef31834a61e632202c1e5dccbf36f93ea37b8ad8 Mon Sep 17 00:00:00 2001 From: Karl Ostmo Date: Tue, 22 Nov 2022 07:21:28 -0800 Subject: [PATCH] Make code reformatting command a script in the repo (#875) --- CONTRIBUTING.md | 5 +++++ scripts/reformat-code.sh | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100755 scripts/reformat-code.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 47b3e5ea9..559594b34 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -226,6 +226,11 @@ cd path/to/the/root/of/swarm/repo find src/ app/ test/ -name "*.hs" | xargs fourmolu --mode=inplace --cabal-default-extensions ``` +For convenience, one may alternatively execute this script: +``` +scripts/reformat-code.sh +``` + There is probably a way to configure your favorite editor to have `fourmolu` automatically applied to your code; but if you don't know how to set that up, don't worry! The [`restyled.io` bot](https://restyled.io/) automatically diff --git a/scripts/reformat-code.sh b/scripts/reformat-code.sh new file mode 100755 index 000000000..1fe7ca37e --- /dev/null +++ b/scripts/reformat-code.sh @@ -0,0 +1,6 @@ +#!/bin/bash -e + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +cd $SCRIPT_DIR/.. + +find src/ app/ test/ -name "*.hs" | xargs fourmolu --mode=inplace --cabal-default-extensions \ No newline at end of file