Skip to content

Commit 0b7af09

Browse files
committed
collect all error in format check
1 parent 476e09e commit 0b7af09

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

.github/workflows/format-check.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,32 @@ jobs:
2929

3030
- name: Check C++ code format
3131
run: |
32-
find . -name "*.cpp" -o -name "*.hpp" -o -name "*.c" -o -name "*.h" -o -name "*.cc" -o -name "*.cxx" | \
32+
EXIT_CODE=0
3333
while read file; do
3434
if ! clang-format --dry-run --Werror "$file"; then
3535
echo "$file is not properly formatted"
3636
echo "Run: clang-format -i $file"
37-
exit 1
37+
EXIT_CODE=1
3838
fi
39-
done
39+
done < <(find . -name "*.cpp" -o -name "*.hpp" -o -name "*.c" -o -name "*.h" -o -name "*.cc" -o -name "*.cxx")
40+
if [ $EXIT_CODE -eq 1 ]; then
41+
echo "Some C/C++ files are not properly formatted"
42+
exit 1
43+
fi
4044
echo "All C/C++ files are properly formatted"
4145
4246
- name: Check CMake code format
4347
run: |
44-
find . -name "CMakeLists.txt" -o -name "*.cmake" | \
48+
EXIT_CODE=0
4549
while read file; do
4650
if ! cmake-format --check "$file"; then
4751
echo "$file is not properly formatted"
4852
echo "Run: cmake-format -i $file"
49-
exit 1
53+
EXIT_CODE=1
5054
fi
51-
done
55+
done < <(find . -name "CMakeLists.txt" -o -name "*.cmake")
56+
if [ $EXIT_CODE -eq 1 ]; then
57+
echo "Some CMake files are not properly formatted"
58+
exit 1
59+
fi
5260
echo "All CMake files are properly formatted"

0 commit comments

Comments
 (0)