Files
EvoBGP/scripts/lint-httpapi.sh
T
DenozordecandCursor 64516c316d
CI / changes (push) Successful in 10s
CI / openapi (push) Has been skipped
CI / web (push) Failing after 41s
CI / go (push) Successful in 52s
CI / docker-web (push) Successful in 2m14s
CI / docker-bird (push) Successful in 1m2s
CI / bird2 (push) Successful in 21s
CI / docker-go (push) Successful in 3m34s
ci: phase 4 automation — web job, lint-httpapi, golangci
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-20 00:23:14 +07:00

29 lines
755 B
Bash

#!/usr/bin/env sh
# Engineering gates for internal/httpapi (ERR-01, ARCH-01).
set -eu
ROOT="$(CDPATH= cd -- "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
HTTPAPI="internal/httpapi"
FAIL=0
echo "==> ERR-01: no err.Error() in 5xx problem details"
if grep -rE 'writeProblem\(w, http\.StatusInternalServerError.*err\.Error\(\)' "$HTTPAPI" 2>/dev/null; then
FAIL=1
fi
if grep -rE 'writeProblem\(w, http\.StatusBadGateway.*err\.Error\(\)' "$HTTPAPI" 2>/dev/null; then
FAIL=1
fi
echo "==> ARCH-01: no SQL/pgx queries in httpapi"
if grep -rE 'pool\.(Query|Exec|QueryRow)|SELECT |INSERT INTO |UPDATE .* SET |DELETE FROM ' "$HTTPAPI" 2>/dev/null; then
FAIL=1
fi
if [ "$FAIL" -ne 0 ]; then
echo "lint-httpapi: failed" >&2
exit 1
fi
echo "lint-httpapi: ok"