From 69d26f531c77bc65eb2fedfe0efd43c67dbbba6f Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 19 Oct 2022 13:34:46 -0300 Subject: bin/check: Move tests to Makefile --- Makefile | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 5d8e2c4..c1723b3 100644 --- a/Makefile +++ b/Makefile @@ -31,5 +31,49 @@ $(XDG_DATA_HOME)/euandreh/e.list.txt: ~/Documents/txt/ opt/aux/gen-e-list.sh +check-shellcheck: + git ls-files | \ + xargs awk '/^#!\/bin\/sh$$/ { print FILENAME } { nextfile }' | \ + xargs shellcheck -x + +check-perlcritic: + git ls-files | \ + xargs awk '/^#!\/usr\/bin\/env perl$$/ { print FILENAME } { nextfile }' | \ + xargs perlcritic + +check-fixme: + if git grep FIXME -- ':(exclude)Makefile'; then \ + printf 'Leftover FIXME markers.\n' >&2; \ + exit 1; \ + fi + +check-dirty-public: + if ! git diff --quiet || ! git diff --quiet --staged; then \ + printf 'Dirty tilde repository.\n' >&2; \ + exit 1; \ + fi + +check-dirty-private: + if ! git -C $(PRIV_CONFIG) diff --quiet || \ + ! git -C $(PRIV_CONFIG) diff --quiet --staged; then \ + printf 'Dirty private tilde repository.\n' >&2; \ + exit 1; \ + fi + +check-opt: + find opt/tests/ -name '*.sh' -exec {} + + +check-pod: + podchecker bin/z + +check-sync: + if git status --short --branch --porcelain | head -n1 | grep -E '(ahead|behind)'; then \ + printf 'Out of sync with origin.\n' >&2; \ + exit 1; \ + fi + +check: check-shellcheck check-perlcritic check-fixme check-dirty-public \ + check-dirty-private check-opt check-pod check-sync + clean: rm -f $(derived-assets) -- cgit v1.2.3