maint/check_todos: New script

This commit is contained in:
Ian Jackson 2023-03-21 11:52:09 +00:00
parent c48b6813b4
commit 541c5338af
1 changed files with 31 additions and 0 deletions

31
maint/check_todos Executable file
View File

@ -0,0 +1,31 @@
#!/usr/bin/env bash
#
# check_todos
#
# Checks for occurrences of /\b X X X+ \b/e
# These will cause CI to fail if pushed anywhere.
set -euo pipefail
printf -- '---------- checking for to-be-rejected TODOs (XX''X) ----------\n'
set +e
git --no-pager grep -P '\bXX''X+\b'
rc=$?
set -e
case $rc in
0)
printf -- '"^^^^^^^^^^ found to-be-rejected TODOs (XX''X) ^^^^^^^^^^\n'
echo >&2 "
To-be-rejected-by-CI TODOs found."
exit 1
;;
1)
# not found, great
exit 0
;;
*)
echo >&2 "git grep failed, status $?"
exit 16
;;
esac