File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -110,3 +110,8 @@ repos:
110110 language : system
111111 files : ^resources/.*\.php$
112112 exclude : ^resources/lib/UnityHTTPD\.php$
113+ - id : assert-forbidden-used
114+ name : Assert forbidden() is used
115+ entry : bash ./test/assert-forbidden-used.bash
116+ language : system
117+ files : ^webroot/admin/.*\.php$
Original file line number Diff line number Diff line change 1+ set -euo pipefail
2+ trap ' s=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
3+ if [[ $# -lt 1 ]]; then
4+ echo " at least one argument required"
5+ exit 1
6+ fi
7+
8+ rc=0
9+ for file in " $@ " ; do
10+ # --color=never because magit git output log doesn't support it
11+ grep_rc=0; grep -q UnityHTTPD::forbidden " $file " || grep_rc=$?
12+ case " $grep_rc " in
13+ 0)
14+ : ;; # code is good, do nothing
15+ 1)
16+ echo " UnityHTTPD::forbidden() was not called in file '$file '!" ; rc=1 ;;
17+ * )
18+ echo " grep failed!" ; rc=1 ;;
19+ esac
20+ done
21+ exit " $rc "
You can’t perform that action at this time.
0 commit comments