初始化
缺陷:主题配色需要优化整体的同风格
This commit is contained in:
43
scripts/lint-all.sh
Normal file
43
scripts/lint-all.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
# Read-only syntax check: php -l over app/config/database/routes,
|
||||
# plus a guard for the historical return -> retun typo.
|
||||
#
|
||||
# Usage (inside an environment that has php, e.g. the 1Panel php-fpm container):
|
||||
# sh scripts/lint-all.sh /www/sites/lgp-api/index/lgp-admin-plus-api
|
||||
# This script never modifies files.
|
||||
set -eu
|
||||
|
||||
BASE=${1:-}
|
||||
if [ -z "$BASE" ]; then
|
||||
BASE=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
fi
|
||||
cd "$BASE"
|
||||
|
||||
TARGETS="app config database routes"
|
||||
|
||||
echo "== syntax =="
|
||||
fail=0
|
||||
count=0
|
||||
for f in $(find $TARGETS -name '*.php' | sort); do
|
||||
count=$((count + 1))
|
||||
out=$(php -l "$f" 2>&1 | grep -v swoole || true)
|
||||
case "$out" in
|
||||
*"No syntax errors"*) ;;
|
||||
*) echo "FAIL $f"; echo "$out"; fail=1 ;;
|
||||
esac
|
||||
done
|
||||
echo "checked $count files"
|
||||
|
||||
echo "== retun typo =="
|
||||
if grep -rn "retun" $TARGETS; then
|
||||
fail=1
|
||||
else
|
||||
echo "none"
|
||||
fi
|
||||
|
||||
if [ "$fail" -eq 0 ]; then
|
||||
echo "ALL OK"
|
||||
else
|
||||
echo "HAS ERRORS"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user