blob: a9c5ef9bc326f58c17ad28e002c077888e2a7ff6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#!/usr/bin/env bash
set -Eeuo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
cd ../
if git grep FIXME | grep -v '^TODOs.org' | grep -v '^scripts/assert-todos.sh'; then
echo "Found dangling FIXME markers on the project."
echo "You should write them down properly on TODOs.org."
exit 1
fi
contains-element() {
local e match="$1"
shift
for e; do [[ "$e" == "$match" ]] && return 0; done
return 1
}
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 grep -E '^\*\* (CANCELLED|DONE)' <(sed "${todo}q;d" TODOs.org) > /dev/null; then
ID_OFFSET=3
else
ID_OFFSET=2
fi
ID="$(sed "$((todo+ID_OFFSET))q;d" TODOs.org)"
if grep '^:CUSTOM_ID: .*$' <(echo "$ID") > /dev/null; then
if contains-element "$ID" "${KNOWN_IDS[@]}"; then
echo "Duplicated ID: $ID"
has_error=1
else
KNOWN_IDS+=("$ID")
fi
else
echo "Missing ID for TODO in line $todo"
has_error=1
fi
done
exit "$has_error"
|