File tree Expand file tree Collapse file tree 4 files changed +15
-14
lines changed Expand file tree Collapse file tree 4 files changed +15
-14
lines changed Original file line number Diff line number Diff line change 22
33set -euo pipefail
44
5- SOURCES=$( git ls-files ' *.c' ' *.cxx' ' *.cpp' ' *.h' ' *.hpp' )
5+ # Get list of source files into array
6+ mapfile -t SOURCES < <( git ls-files ' *.c' ' *.cxx' ' *.cpp' ' *.h' ' *.hpp' )
67
78# Use clang-format dry-run mode with --Werror to fail on format violations
89# This eliminates the need for temporary files and manual diff comparisons
9- clang-format-18 -n --Werror ${SOURCES}
10+ clang-format-18 -n --Werror " ${SOURCES[@]} "
Original file line number Diff line number Diff line change 44set -euo pipefail
55
66# Detect platform
7- MACHINE_TYPE=$( uname -m)
8- OS_TYPE=$( uname -s)
7+ MACHINE_TYPE=" $( uname -m) "
8+ OS_TYPE=" $( uname -s) "
99
1010# Cleanup function - kills all semu processes
1111cleanup () {
@@ -22,14 +22,14 @@ ASSERT() {
2222 local exit_code
2323
2424 set +e
25- cmd_output=$( " $@ " 2>&1 )
25+ cmd_output=" $( " $@ " 2>&1 ) "
2626 exit_code=$?
2727 set -e
2828
29- if [ $exit_code -ne 0 ]; then
29+ if [ " $exit_code " -ne 0 ]; then
3030 echo " Assert failed: $* " >&2
3131 echo " Output: $cmd_output " >&2
32- exit $exit_code
32+ exit " $exit_code "
3333 fi
3434}
3535
@@ -59,7 +59,7 @@ get_timeout() {
5959}
6060
6161# Export TIMEOUT for use in scripts
62- TIMEOUT=$( get_timeout)
62+ TIMEOUT=" $( get_timeout) "
6363export TIMEOUT
6464
6565# Color codes for output
Original file line number Diff line number Diff line change 2020
2121# Test network device functionality
2222TEST_NETDEV () {
23- local NETDEV=$1
23+ local NETDEV=" $1 "
2424 local CMD_PREFIX=" "
2525
2626 if [ " $NETDEV " == " tap" ]; then
Original file line number Diff line number Diff line change @@ -111,20 +111,20 @@ jobs:
111111 run : |
112112 set -euo pipefail
113113
114- # Get list of source files
115- SOURCES=$ (git ls-files '*.c' '*.cxx' '*.cpp' '*.h' '*.hpp')
114+ # Get list of source files into array
115+ mapfile -t SOURCES < < (git ls-files '*.c' '*.cxx' '*.cpp' '*.h' '*.hpp')
116116
117117 # Register cleanup function to restore files on exit
118118 cleanup_files() {
119- if [ -n "${ SOURCES:-}" ]; then
119+ if [ ${# SOURCES[@]} -gt 0 ]; then
120120 echo "Restoring files to original state..."
121- git checkout -- ${SOURCES} 2>/dev/null || true
121+ git checkout -- " ${SOURCES[@]}" 2>/dev/null || true
122122 fi
123123 }
124124 trap cleanup_files EXIT INT TERM
125125
126126 # Apply clang-format in-place to generate diff
127- clang-format-18 -i ${SOURCES}
127+ clang-format-18 -i " ${SOURCES[@]}"
128128
129129 # Generate diff and pipe to reviewdog
130130 # Note: reviewdog exit code doesn't affect cleanup due to trap
You can’t perform that action at this time.
0 commit comments