We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e4fd195 commit 532080fCopy full SHA for 532080f
.pre-commit-config.yaml
@@ -48,3 +48,10 @@ repos:
48
language: system
49
files: \.php$
50
args: [-l]
51
+ - repo: local
52
+ hooks:
53
+ - id: assert-no-die
54
+ name: Assert No Die
55
+ entry: ./test/assert-no-die.bash
56
+ language: system
57
+ files: \.php$
test/assert-no-die.bash
@@ -0,0 +1,12 @@
1
+#!/bin/bash
2
+set -euo pipefail
3
+if [[ $# -lt 1 ]]; then
4
+ echo "at least one argument required" >&2
5
+ exit 1
6
+fi
7
+occurrences="$(grep -H --line-number --color=always -P '\bdie\s*\(' "$@" | grep -v -P 'UnitySite::die\s*\(')" || true
8
+if [ -n "$occurrences" ]; then
9
+ echo "die() is not allowed! use UnitySite::die() instead." >&2
10
+ echo "$occurrences"
11
12
0 commit comments