diff options
author | EuAndreh <eu@euandre.org> | 2021-01-23 19:58:33 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-01-23 19:58:33 -0300 |
commit | 79cf4f23d77ddaf68c9a8c6d227fb6b4c2b7e652 (patch) | |
tree | 3a6403d97ea8b14efd8b80c148e0cfc3058ac8ac /build-aux/assert-todos.sh | |
parent | {scripts => build-aux}/assert-shellcheck.sh (diff) | |
download | euandre.org-79cf4f23d77ddaf68c9a8c6d227fb6b4c2b7e652.tar.gz euandre.org-79cf4f23d77ddaf68c9a8c6d227fb6b4c2b7e652.tar.xz |
Add (but not activate) build-aux/assert-todos.sh
Diffstat (limited to '')
-rwxr-xr-x | build-aux/assert-todos.sh | 34 |
1 files changed, 34 insertions, 0 deletions
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 |