mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-13 09:05:11 +01:00
c124aad02d
## 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 []" ```
27 lines
726 B
Bash
Executable File
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
|