aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-01-22 18:32:46 -0300
committerEuAndreh <eu@euandre.org>2021-01-22 18:32:53 -0300
commitaa4a1838f4c6934130d6ea1df75ab613ccdea9ca (patch)
tree565d9922ef1cbe849202f1c512a0ac81f996c3cd
parentAdd build-aux/with-container.sh and the supporting files under guix/ (diff)
downloadremembering-aa4a1838f4c6934130d6ea1df75ab613ccdea9ca.tar.gz
remembering-aa4a1838f4c6934130d6ea1df75ab613ccdea9ca.tar.xz
Makefile: Add assert-todos.sh to check phase
-rw-r--r--Makefile1
-rwxr-xr-xbuild-aux/assert-todos.sh34
2 files changed, 35 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 61f4072..5e26a5b 100644
--- a/Makefile
+++ b/Makefile
@@ -32,6 +32,7 @@ check:
if [ -d .git ]; then \
echo 'Assuming Git repository, running development checks.'; \
sh build-aux/assert-shellcheck.sh; \
+ sh build-aux/assert-todos.sh; \
fi
dist:
diff --git a/build-aux/assert-todos.sh b/build-aux/assert-todos.sh
new file mode 100755
index 0000000..0b0a8d6
--- /dev/null
+++ b/build-aux/assert-todos.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+set -eu
+
+if git grep FIXME | grep -v '^TODOs.md' | grep -v '^build-aux/assert-todos.sh' | grep -v '^build-aux/docbook-xsl/'; then
+ echo "Found dangling FIXME markers on the project."
+ echo "You should write them down properly on TODOs.md."
+ exit 1
+fi
+
+awk -F'{#' '
+BEGIN {
+ status=0
+ idx=0
+ delete ids[0]
+}
+/^## / {
+ if (match($0, / \{#.*?\}$/) == 0) {
+ print "Missing ID for line " NR ":\n" $0
+ status=1
+ }
+ id_with_prefix = substr($2, 0, length($2) - 1)
+ match(id_with_prefix, /^\w+-/)
+ id = substr(id_with_prefix, RLENGTH + 1)
+ if (id in arr) {
+ print "Duplicate ID: " id
+ status=1
+ } else {
+ arr[id] = 1
+ }
+}
+/^# Improvements$/ {
+ exit status
+}
+' TODOs.md