aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2021-12-28 21:43:45 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2021-12-28 21:43:45 +0100
commitbbb2a93d1516ef3f92f1150895dbddc9d924e454 (patch)
treec114ebd8dc5c77cec4d6b0328a32f323de279abc
parent5904cdb7134bbfe7ce226e095fa9ed6c1784cbfa (diff)
downloadvis-spellcheck-bbb2a93d1516ef3f92f1150895dbddc9d924e454.tar.gz
make: use POSIX check-format
-rw-r--r--Makefile7
-rwxr-xr-xtools/check-format8
2 files changed, 10 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index c43eeda..0fcc468 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,6 @@
.PHONY: check format check-luacheck check-format
-LUA_FILES = $(wildcard *.lua)
-
-# bash's process substitution is used for check-format
-SHELL := /bin/bash
+LUA_FILES := $(wildcard *.lua)
check: check-luacheck check-format
@@ -11,7 +8,7 @@ check-luacheck:
luacheck --globals=vis -- $(LUA_FILES)
check-format:
- for f in $(LUA_FILES); do diff $$f <(lua-format $$f) >/dev/null; done
+ for lf in $(LUA_FILES); do tools/check-format "$${lf}"; done
format:
lua-format -i $(LUA_FILES)
diff --git a/tools/check-format b/tools/check-format
new file mode 100755
index 0000000..392d023
--- /dev/null
+++ b/tools/check-format
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+LUA_FILE=$1
+lua-format "${LUA_FILE}" > "${LUA_FILE}.fmt"
+diff "${LUA_FILE}" "${LUA_FILE}.fmt"
+RET=$?
+rm "${LUA_FILE}.fmt"
+exit ${RET}