@@ -15,16 +15,6 @@ set -euo pipefail
1515# true: sync root .vscode config files to Template/.vscode when staged.
1616: " ${PRECOMMIT_ENABLE_VSCODE_SYNC:= true} "
1717
18- # true: run dotnet format on detected changed C# files.
19- : " ${PRECOMMIT_ENABLE_FORMAT:= true} "
20-
21- # true: remove optional braces around return;, return true;, and return false; blocks.
22- : " ${PRECOMMIT_ENABLE_FORMAT_RETURNS:= true} "
23-
24- # dotnet format mode: whitespace or full.
25- # whitespace is faster for commit-time checks while still using dotnet format.
26- : " ${PRECOMMIT_FORMAT_MODE:= full} "
27-
2818# true: run targeted builds for changed project areas.
2919: " ${PRECOMMIT_ENABLE_BUILD_GODOTUTILS:= true} "
3020: " ${PRECOMMIT_ENABLE_BUILD_VISUALIZE:= true} "
@@ -71,13 +61,6 @@ build_packetgen=false
7161build_optionsgen=false
7262build_template=false
7363
74- declare -a format_godotutils=()
75- declare -a format_visualize=()
76- declare -a format_packetgen=()
77- declare -a format_optionsgen=()
78- declare -a format_template=()
79- declare -a format_fallback=()
80-
8164# Only run full solution validation when staged files can affect compilation.
8265requires_full_build=false
8366
@@ -109,29 +92,6 @@ for staged_path in "${STAGED_PATHS[@]}"; do
10992 esac
11093done
11194
112- for cs_path in " ${STAGED_CS[@]} " ; do
113- case " $cs_path " in
114- Template.GodotUtils/* .cs)
115- format_godotutils+=(" $cs_path " )
116- ;;
117- Template.Visualize/* .cs)
118- format_visualize+=(" $cs_path " )
119- ;;
120- Template.PacketGen/* .cs)
121- format_packetgen+=(" $cs_path " )
122- ;;
123- Template.OptionsGen/* .cs)
124- format_optionsgen+=(" $cs_path " )
125- ;;
126- Template/* .cs)
127- format_template+=(" $cs_path " )
128- ;;
129- * )
130- format_fallback+=(" $cs_path " )
131- ;;
132- esac
133- done
134-
13595# Visualize depends on GodotUtils
13696if $build_visualize ; then
13797 build_godotutils=true
@@ -160,34 +120,6 @@ if echo "$STAGED" | grep -Eq "^\.vscode/(extensions|settings|tasks)\.json$"; the
160120 fi
161121fi
162122
163- # ------------------------------------------------------------
164- # Format changed C# files only
165- # ------------------------------------------------------------
166-
167- if is_enabled " $PRECOMMIT_ENABLE_FORMAT " ; then
168- " $SCRIPTS_DIR /format-cs" " $REPO_ROOT /Template.GodotUtils/GodotUtils.csproj" " $PRECOMMIT_FORMAT_MODE " " ${format_godotutils[@]} "
169- " $SCRIPTS_DIR /format-cs" " $REPO_ROOT /Template.Visualize/Visualize.csproj" " $PRECOMMIT_FORMAT_MODE " " ${format_visualize[@]} "
170- " $SCRIPTS_DIR /format-cs" " $REPO_ROOT /Template.PacketGen/PacketGen.sln" " $PRECOMMIT_FORMAT_MODE " " ${format_packetgen[@]} "
171- " $SCRIPTS_DIR /format-cs" " $REPO_ROOT /Template.OptionsGen/OptionsGen/OptionsGen.csproj" " $PRECOMMIT_FORMAT_MODE " " ${format_optionsgen[@]} "
172- " $SCRIPTS_DIR /format-cs" " $REPO_ROOT /Template/Template.csproj" " $PRECOMMIT_FORMAT_MODE " " ${format_template[@]} "
173-
174- if [ " ${# format_fallback[@]} " -gt 0 ]; then
175- echo " [pre-commit] Formatting fallback (Template.sln) for unmapped C# paths..."
176- " $SCRIPTS_DIR /format-cs" " $REPO_ROOT /Template.sln" " $PRECOMMIT_FORMAT_MODE " " ${format_fallback[@]} "
177- fi
178- else
179- echo " [pre-commit] Formatting disabled by PRECOMMIT_ENABLE_FORMAT=false"
180- fi
181-
182- # ------------------------------------------------------------
183- # Normalize return brace style
184- # ------------------------------------------------------------
185- if is_enabled " $PRECOMMIT_ENABLE_FORMAT_RETURNS " ; then
186- " $SCRIPTS_DIR /format-returns" " ${STAGED_CS[@]} "
187- else
188- echo " [pre-commit] Return formatting disabled by PRECOMMIT_ENABLE_FORMAT_RETURNS=false"
189- fi
190-
191123# ------------------------------------------------------------
192124# Build GodotUtils
193125# ------------------------------------------------------------
0 commit comments