Skip to content

Commit 39365c1

Browse files
feat: Unstaged files and unformatted files (MAPCO-8847) (#28)
* add files to gitignore * stop tracking files * update format git flow * fix format file
1 parent 01c662d commit 39365c1

11 files changed

+39
-6011
lines changed

.github/workflows/format.yaml

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,37 +38,55 @@ jobs:
3838
echo "solution_count=$count" >> "$GITHUB_OUTPUT"
3939
4040
- name: Check formatting
41-
if: steps.discover.outputs.solution_count != '0'
4241
shell: bash
4342
run: |
4443
set -euo pipefail
45-
while IFS= read -r sln; do
46-
[ -z "$sln" ] && continue
47-
echo "==> Restoring $sln"
48-
dotnet restore "$sln"
44+
ROOT="${GITHUB_WORKSPACE}"
4945
50-
echo "==> Running jb cleanupcode"
51-
jb cleanupcode "$sln" \
46+
count="${{ steps.discover.outputs.solution_count }}"
47+
if [ "$count" != "0" ]; then
48+
echo "==> Formatting all discovered .sln files"
49+
while IFS= read -r sln; do
50+
[ -z "$sln" ] && continue
51+
echo "==> Restoring $sln"
52+
dotnet restore "$sln"
53+
54+
echo "==> Running jb cleanupcode on $sln"
55+
jb cleanupcode "$sln" \
56+
--profile="Built-in: Reformat Code" \
57+
--no-build \
58+
--verbosity=WARN \
59+
--include="$ROOT/Assets/**/*.cs" \
60+
--exclude="$ROOT/**/bin/**" \
61+
--exclude="$ROOT/**/obj/**" \
62+
--exclude="$ROOT/**/.idea/**" \
63+
--exclude="$ROOT/**/Library/**" \
64+
--exclude="$ROOT/**/Logs/**" \
65+
--exclude="$ROOT/**/Temp/**"
66+
done < solutions.txt
67+
else
68+
echo "==> No .sln files found. Running jb cleanupcode by glob include (absolute paths)."
69+
jb cleanupcode "$ROOT" \
5270
--profile="Built-in: Reformat Code" \
53-
--no-build \
5471
--verbosity=WARN \
55-
--include="Assets/**/*.cs" \
56-
--exclude="**/bin/**" \
57-
--exclude="**/obj/**" \
58-
--exclude="**/.idea/**" \
59-
--exclude="**/Library/**" \
60-
--exclude="**/Logs/**" \
61-
--exclude="**/Temp/**"
62-
done < solutions.txt
72+
--include="$ROOT/Assets/**/*.cs" \
73+
--exclude="$ROOT/**/bin/**" \
74+
--exclude="$ROOT/**/obj/**" \
75+
--exclude="$ROOT/**/.idea/**" \
76+
--exclude="$ROOT/**/Library/**" \
77+
--exclude="$ROOT/**/Logs/**" \
78+
--exclude="$ROOT/**/Temp/**"
79+
fi
6380
6481
- name: Diff & annotate unformatted files (fail if any)
65-
if: steps.discover.outputs.solution_count != '0'
6682
shell: bash
6783
run: |
6884
set -euo pipefail
6985
DIFF_FILE=cleanup.diff
7086
git --no-pager diff --unified=0 -- 'Assets/**/*.cs' > "$DIFF_FILE" || true
7187
88+
git --no-pager diff --name-only -- 'Assets/**/*.cs' || true
89+
7290
if [ -s "$DIFF_FILE" ]; then
7391
echo "Unformatted changes detected in Assets/:"
7492
awk '
@@ -85,7 +103,3 @@ jobs:
85103
else
86104
echo "Formatting is clean in Assets/."
87105
fi
88-
89-
- name: No solutions found (informative)
90-
if: steps.discover.outputs.solution_count == '0'
91-
run: echo "No .sln files found; skipping formatting check."

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
# Autogenerated VS/MD/Consulo solution and project files
4747
ExportedObj/
4848
.consulo/
49+
*.sln
50+
*.csproj
4951
*.unityproj
5052
*.suo
5153
*.tmp
@@ -58,6 +60,8 @@ ExportedObj/
5860
*.mdb
5961
*.opendb
6062
*.VC.db
63+
*.csproj.DotSettings.user
64+
*.sln.DotSettings.user
6165

6266
# Unity3D generated meta files
6367
*.pidb.meta

Assembly-CSharp-Editor.csproj

Lines changed: 0 additions & 995 deletions
This file was deleted.

Assembly-CSharp.csproj

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)