diff options
author | EuAndreh <eu@euandre.org> | 2021-01-10 10:35:48 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-01-10 10:42:06 -0300 |
commit | f0c75e1433d0c91729d2fb3814c9fdac4bf42ffd (patch) | |
tree | 679b86c09d3a1bbc5c8a5c1dccde69467af0f947 | |
parent | Move workflow/ to build-aux/workflow/ (diff) | |
download | server-f0c75e1433d0c91729d2fb3814c9fdac4bf42ffd.tar.gz server-f0c75e1433d0c91729d2fb3814c9fdac4bf42ffd.tar.xz |
Readd assert-todos.sh
-rw-r--r-- | Makefile | 2 | ||||
-rwxr-xr-x | build-aux/assert-todos.sh | 38 |
2 files changed, 39 insertions, 1 deletions
@@ -1,7 +1,7 @@ .PHONY: check check: ./build-aux/assert-shellcheck.sh - # ./build-aux/assert-todos.sh + ./build-aux/assert-todos.sh ./build-aux/assert-terraform.sh .PHONY: clean diff --git a/build-aux/assert-todos.sh b/build-aux/assert-todos.sh new file mode 100755 index 0000000..3fe513a --- /dev/null +++ b/build-aux/assert-todos.sh @@ -0,0 +1,38 @@ +#!/bin/sh -eu + +if git grep FIXME | grep -v '^TODOs.org' | 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.org." + exit 1 +fi + +KNOWN_IDS='' +has_error=0 +# shellcheck disable=2013 +for todo in $(sed -e '/^\* Tasks$/,/^\* Improvements$/!d' TODOs.org | grep -nE '^\*\* .*$' | cut -d: -f1); do + if sed "${todo}q;d" TODOs.org | grep -qE '^\*\* (CANCELLED|DONE)'; then + ID_OFFSET=3 + else + ID_OFFSET=2 + fi + line_n="$((todo+ID_OFFSET))" + ID_LINE="$(sed "${line_n}q;d" TODOs.org)" + if echo "$ID_LINE" | grep -q '^:CUSTOM_ID: .*$'; then + ID="$(echo "$ID_LINE" | awk '{print $2}')" + if echo "$KNOWN_IDS" | grep -q "$ID"; then + echo "Duplicated ID: $ID" + has_error=1 + else + if [ -z "$KNOWN_IDS" ]; then + KNOWN_IDS="$ID" + else + KNOWN_IDS="$KNOWN_IDS:$ID" + fi + fi + else + echo "Missing ID for TODO in line $line_n" + has_error=1 + fi +done + +exit "$has_error" |