#!/bin/bash set -euo pipefail TARGET="${1:-$PWD}" echo "↩️ Normalizing line endings and checking Python syntax in $TARGET" # Normalize CRLF=>LF without extra deps grep -Irl $'\r' "$TARGET" | while read -r f; do perl -pi -e 's/\r\n/\n/g' "$f" done echo "🧪 Python syntax check (py_compile)..." python3 - <<'PY' import os, py_compile base = os.environ.get("TARGET",".") errs=0 for root,_,files in os.walk(base): for fn in files: if fn.endswith(".py"): p=os.path.join(root,fn) try: py_compile.compile(p,doraise=True) except Exception as e: print(f"❌ {p}: {e}"); errs+=1 if errs: exit(2) print("✅ Python syntax OK") PY