初始化

缺陷:主题配色需要优化整体的同风格
This commit is contained in:
2026-08-14 23:21:21 +08:00
parent 6e2769c528
commit bcf54c2727
152 changed files with 13521 additions and 141 deletions

41
scripts/lint.sh Normal file
View File

@@ -0,0 +1,41 @@
#!/usr/bin/env bash
# 语法检查 + 行尾规整
#
# 从 Windows 侧的 UNC 路径写文件会带 CRLFPHP 能跑但和仓库里其余 LF 文件混排,
# diff 会整片变红。这里统一转成 LF 再 php -l。
#
# 用法bash scripts/lint.sh [目录或文件 ...] 不带参数则检查 app/ routes/ config/
set -uo pipefail
cd "$(diname "$0")/.." || exit 1
TARGETS=("$@")
if [ ${#TARGETS[@]} -eq 0 ]; then
TARGETS=(app routes config database)
fi
mapfile -t FILES < <(find "${TARGETS[@]}" -type f -name '*.php' 2>/dev/null | sort)
if [ ${#FILES[@]} -eq 0 ]; then
echo "no php files under: ${TARGETS[*]}"
exit 0
fi
CRLF_FIXED=0
for f in "${FILES[@]}"; do
if grep -qU $'\r' "$f" 2>/dev/null; then
perl -pi -e 's/\r\n/\n/' "$f"
CRLF_FIXED=$((CRLF_FIXED + 1))
fi
done
FAILED=0
for f in "${FILES[@]}"; do
if ! out=$(php -l "$f" 2>&1); then
echo "$out"
FAILED=$((FAILED + 1))
fi
done
echo "checked=${#FILES[@]} crlf_fixed=${CRLF_FIXED} syntax_errors=${FAILED}"
[ "$FAILED" -eq 0 ]