diff options
author | EuAndreh <eu@euandre.org> | 2023-04-04 12:15:53 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-04-04 12:16:21 -0300 |
commit | 026f278ba430c118649a9ba7c685cd15ebe46cda (patch) | |
tree | bc810292932b1989a71c678d23f38919c2f42070 /v2 | |
parent | Makefile: Add ShellCheck to "check" target (diff) | |
download | euandre.org-026f278ba430c118649a9ba7c685cd15ebe46cda.tar.gz euandre.org-026f278ba430c118649a9ba7c685cd15ebe46cda.tar.xz |
Add aux/checks/todos.sh
Diffstat (limited to 'v2')
l--------- | v2/TODOs.md | 1 | ||||
-rwxr-xr-x | v2/aux/checks/todos.sh | 58 | ||||
-rw-r--r-- | v2/dynamic.mk | 1 |
3 files changed, 60 insertions, 0 deletions
diff --git a/v2/TODOs.md b/v2/TODOs.md new file mode 120000 index 0000000..090bb76 --- /dev/null +++ b/v2/TODOs.md @@ -0,0 +1 @@ +../TODOs.md
\ No newline at end of file diff --git a/v2/aux/checks/todos.sh b/v2/aux/checks/todos.sh new file mode 100755 index 0000000..6325ebd --- /dev/null +++ b/v2/aux/checks/todos.sh @@ -0,0 +1,58 @@ +#!/bin/sh +set -eu + +if [ -e .git ] && git grep FIXME | grep -v '^TODOs.md' | + grep -v '^aux/checks/todos.sh'; 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 { + exitstatus = 0 + h2flag = 0 + h2status = "" + prevline = "" + idx = 0 + delete ids[0] +} +h2flag == 1 { + split($0, l, " ") + timelinestatus = l[2] + if (h2status != timelinestatus) { + print "h2/timeline status mismatch for line " NR-1 + print prevline + print $0 + exitstatus = 1 + } + h2status = "" + h2flag = 0 +} + +/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE|WONTFIX)/ { + if (match($0, / \{#.*?\}.*$/) == 0) { + print "Missing ID for line " NR ":\n" $0 + exitstatus = 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 + exitstatus = 1 + } else { + arr[id] = 1 + } + + split($0, l, " ") + h2status = l[2] + h2flag = 1 + prevline = $0 +} + + +/^# Scratch$/ { + exit exitstatus +} +' TODOs.md diff --git a/v2/dynamic.mk b/v2/dynamic.mk index 92ff6ee..99436bb 100644 --- a/v2/dynamic.mk +++ b/v2/dynamic.mk @@ -87,6 +87,7 @@ src/content/.well-known/security.txt: src/content/public.asc.txt src/development test-files = \ aux/checks/shellcheck.sh \ + aux/checks/todos.sh \ $(test-files): ALWAYS sh $@ |