fix: enforce storage and tooling invariants
This commit is contained in:
+25
-4
@@ -18,6 +18,7 @@ OVERALL=false
|
||||
ERRORS=()
|
||||
FIXES=()
|
||||
OWNED_GDSCRIPT_ROOTS=(player simulation tests tools world)
|
||||
REQUIRED_GODOT_SERIES="4.7"
|
||||
|
||||
# -- tool detection -----------------------------------------------------------
|
||||
console_godot_path() {
|
||||
@@ -50,6 +51,7 @@ find_godot() {
|
||||
if [[ -n "${GODOT_BIN:-}" ]]; then console_godot_path "$GODOT_BIN" && return 0; echo "$GODOT_BIN"; return 0; fi
|
||||
find_project_godot && return 0
|
||||
for c in godot godot4; do command -v "$c" &>/dev/null && echo "$c" && return 0; done
|
||||
console_godot_path "/Applications/Godot.app/Contents/MacOS/Godot" && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -144,6 +146,19 @@ if [[ -z "$GODOT" ]]; then
|
||||
echo "ERROR: Godot binary not found. Set GODOT_BIN or add godot/godot4 to PATH."
|
||||
exit 1
|
||||
fi
|
||||
if ! GODOT_VERSION="$("$GODOT" --version 2>&1)"; then
|
||||
echo "ERROR: Could not query the Godot version from '$GODOT'."
|
||||
exit 1
|
||||
fi
|
||||
GODOT_VERSION="${GODOT_VERSION%%$'\n'*}"
|
||||
GODOT_VERSION="${GODOT_VERSION%$'\r'}"
|
||||
case "$GODOT_VERSION" in
|
||||
"$REQUIRED_GODOT_SERIES"|"$REQUIRED_GODOT_SERIES".*|"$REQUIRED_GODOT_SERIES"-*) ;;
|
||||
*)
|
||||
echo "ERROR: Godot $REQUIRED_GODOT_SERIES.x is required; found '$GODOT_VERSION'."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
GODOT_ENV=(env "HOME=$GODOT_PROFILE" "APPDATA=$GODOT_PROFILE" "LOCALAPPDATA=$GODOT_PROFILE")
|
||||
|
||||
# -- 0. Godot import bootstrap ------------------------------------------------
|
||||
@@ -185,8 +200,10 @@ fmt_result="PASS"
|
||||
fmt_failed=false
|
||||
: > "$LOG/gdformat.log"
|
||||
if ! has_gdformat; then
|
||||
fmt_result="SKIPPED"
|
||||
fmt_result="FAIL"
|
||||
echo "gdformat not found — install requirements-dev.txt (see docs/local_quality_gate.md)" > "$LOG/gdformat.log"
|
||||
ERRORS+=("gdformat: required formatter not found")
|
||||
FIXES+=("Install the pinned dev tools from requirements-dev.txt")
|
||||
else
|
||||
if $CHANGED; then
|
||||
files=$(changed_gd)
|
||||
@@ -231,8 +248,10 @@ lint_result="PASS"
|
||||
lint_failed=false
|
||||
: > "$LOG/gdlint.log"
|
||||
if ! has_gdlint; then
|
||||
lint_result="SKIPPED"
|
||||
lint_result="FAIL"
|
||||
echo "gdlint not found — install requirements-dev.txt (see docs/local_quality_gate.md)" > "$LOG/gdlint.log"
|
||||
ERRORS+=("gdlint: required linter not found")
|
||||
FIXES+=("Install the pinned dev tools from requirements-dev.txt")
|
||||
else
|
||||
if $CHANGED; then
|
||||
files=$(changed_gd)
|
||||
@@ -294,9 +313,9 @@ if grep -qE "SCRIPT ERROR:|Parse Error:|Failed to load script" "$LOG/godot-check
|
||||
godot_result="FAIL"
|
||||
fi
|
||||
if [[ "$godot_result" == "FAIL" ]]; then
|
||||
grep -iE "error|warning|parse|syntax" "$LOG/godot-check.log" 2>/dev/null | head -20 | while IFS= read -r errline; do
|
||||
while IFS= read -r errline; do
|
||||
ERRORS+=("godot: $errline")
|
||||
done
|
||||
done < <(grep -iE "error|warning|parse|syntax" "$LOG/godot-check.log" 2>/dev/null | head -20)
|
||||
FIXES+=("Fix Godot parser errors")
|
||||
fi
|
||||
|
||||
@@ -356,6 +375,7 @@ if $OVERALL; then
|
||||
else
|
||||
echo "QUALITY RESULT: PASS"
|
||||
fi
|
||||
echo "Godot: $GODOT_VERSION"
|
||||
echo ""
|
||||
echo " godot-import $import_result"
|
||||
echo " gdformat $fmt_result"
|
||||
@@ -393,6 +413,7 @@ echo ""
|
||||
|
||||
{
|
||||
echo "QUALITY RESULT: $($OVERALL && echo FAIL || echo PASS)"
|
||||
echo "Godot: $GODOT_VERSION"
|
||||
echo ""
|
||||
echo " godot-import $import_result"
|
||||
echo " gdformat $fmt_result"
|
||||
|
||||
Reference in New Issue
Block a user