From 3a2fce2ce03b1af4b389fa537ed0cf6a402a7af4 Mon Sep 17 00:00:00 2001 From: VinPropane Date: Sat, 25 Apr 2026 22:48:49 -0400 Subject: [PATCH] NEO-29: enforce AAA markers in changed C# tests Extend the pre-commit guard to fail when staged server test files lack explicit Arrange/Act/Assert markers, so AAA style compliance is checked automatically instead of relying on review memory. --- scripts/git-hooks/pre-commit | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/git-hooks/pre-commit b/scripts/git-hooks/pre-commit index ff710bd..9014a4e 100755 --- a/scripts/git-hooks/pre-commit +++ b/scripts/git-hooks/pre-commit @@ -43,3 +43,18 @@ if has_staged_match '^client/scripts/.*\.gd$'; then exit 1 fi fi + +# Enforce explicit AAA markers in changed C# test files. +for f in "${staged_files[@]}"; do + if [[ ! "$f" =~ ^server/NeonSprawl\.Server\.Tests/.*Tests\.cs$ ]]; then + continue + fi + if [[ ! -f "$f" ]]; then + continue + fi + if ! rg -q 'Arrange' "$f" || ! rg -q 'Act' "$f" || ! rg -q 'Assert' "$f"; then + echo "pre-commit: $f is missing explicit AAA markers (Arrange/Act/Assert)." >&2 + echo "Add clear Arrange/Act/Assert sections in changed C# tests." >&2 + exit 1 + fi +done