check_todos
1 #!/usr/bin/env bash 2 # 3 # check_todos 4 # 5 # Checks for occurrences of /\b X X X+ \b/e 6 # These will cause CI to fail if pushed anywhere. 7 8 set -euo pipefail 9 10 printf -- '---------- checking for to-be-rejected TODOs (XX''X) ----------\n' 11 12 set +e 13 git --no-pager grep -P '\bXX''X+\b' 14 rc=$? 15 set -e 16 case $rc in 17 0) 18 printf -- '"^^^^^^^^^^ found to-be-rejected TODOs (XX''X) ^^^^^^^^^^\n' 19 echo >&2 " 20 To-be-rejected-by-CI TODOs found." 21 22 cat <<'END' 23 24 If these are real blocking todos, they must be fixed or downgraded before merge. 25 26 If these are not real todos, but literals, consider the following workarounds: 27 28 - In Rust source, use a numerical escape 29 example: maint/fixup-features/src/main.rs, const COMPLAINT 30 31 - In a shell script, interject or add redundant quoting 32 examples: maint/check_todos; maint/binary_size, call to mktemp 33 34 - In a regexp, use the "extended" format and insert spaces 35 example: maint/check_todos, head comment 36 37 - In a markdown doc, use a numerical escape, possibly converting `...` to <code>...<code> 38 example: CHANGELOG.md, entry for 0.0.3, under "Cleanups", 2nd bullet point 39 40 - In a comment, use a circumlocution 41 END 42 43 exit 1 44 ;; 45 1) 46 # not found, great 47 exit 0 48 ;; 49 *) 50 echo >&2 "git grep failed, status $?" 51 exit 16 52 ;; 53 esac