Files
Bubberstation/tools/ci/check_misc.sh
Chen Marisa c124aad02d Add new CI linter to check for unescaped brackets (#94718)
## About The Pull Request
- Port of https://github.com/Monkestation/Monkestation2.0/pull/10283


Adds a CI checker for unescaped brackets ([]) in strings.

Examples:
```
// Flag
var/wuh = "[] mrrp"

// Flag
bluh("whu [] guh buh")

// Flag
var/meow = {"
	[]
	[]
	mewr
	wefwefa"}
	
// Flag
var/varasdf = "sdfk;lkdsf \
ok  []\
what the heck []"
```
2026-01-05 21:29:52 -07:00

27 lines
726 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
find . -name "*.php" -print0 | xargs -0 -n1 php -l
find . -name "*.json" -not -path "*/node_modules/*" -print0 | xargs -0 python3 ./tools/json_verifier.py
tools/bootstrap/python -m CatchUnescapedBrackets -i "tools/" "$@"
set +e
tools/bootstrap/python -m CatchUnescapedBrackets tools/CatchUnescapedBrackets/pass.dm >/dev/null 2>&1
status=$?
set -e
if [ $status -eq 1 ]; then
echo "Error: CatchUnescapedBrackets/pass.dm failed validation."
exit 1
fi
set +e
tools/bootstrap/python -m CatchUnescapedBrackets tools/CatchUnescapedBrackets/fail.dm >/dev/null 2>&1
status=$?
set -e
if [ $status -eq 0 ]; then
echo "Error: CatchUnescapedBrackets/fail.dm passed validation."
exit 1
fi