Skip to content

Commit 23c5bb9

Browse files
committed
pre-commit: enable shfmt and shellcheck
1 parent 9baf7fc commit 23c5bb9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+873
-850
lines changed

.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@ repos:
5858
- id: ruff-check
5959
- id: ruff-format
6060

61+
- repo: https://github.com/shellcheck-py/shellcheck-py
62+
rev: v0.11.0.1
63+
hooks:
64+
- id: shellcheck
65+
exclude: ^apps/HelloAndroid.*/gradlew$
66+
67+
- repo: https://github.com/maxwinterstein/shfmt-py
68+
rev: v3.12.0.1
69+
hooks:
70+
- id: shfmt
71+
args: [ -i, "4", -ci, -s, -w ]
72+
exclude: ^apps/HelloAndroid.*/gradlew$
73+
6174
- repo: https://github.com/ComPWA/taplo-pre-commit
6275
rev: v0.9.3
6376
hooks:

apps/HelloAndroid/build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ c++ jni/hello_generator.cpp ../../tools/GenGen.cpp \
88
-L ../../bin -lHalide -ldl -lpthread -lz \
99
-o bin/hello_generator
1010

11-
for archs in arm-32-android,armeabi arm-32-android-armv7s,armeabi-v7a arm-64-android,arm64-v8a x86-64-android-sse41,x86_64 x86-32-android,x86 ; do
11+
for archs in arm-32-android,armeabi arm-32-android-armv7s,armeabi-v7a arm-64-android,arm64-v8a x86-64-android-sse41,x86_64 x86-32-android,x86; do
1212
IFS=,
1313
set $archs
1414
HL_TARGET=$1
1515
ANDROID_ABI=$2
16-
mkdir -p bin/$ANDROID_ABI
17-
./bin/hello_generator -g hello -o bin/$ANDROID_ABI target=$HL_TARGET
16+
mkdir -p bin/"$ANDROID_ABI"
17+
./bin/hello_generator -g hello -o bin/"$ANDROID_ABI" target="$HL_TARGET"
1818
unset IFS
1919
done
2020

apps/HelloAndroidCamera2/build.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ c++ jni/deinterleave_generator.cpp ../../tools/GenGen.cpp \
2020
-L ../../bin -lHalide -ldl -lpthread -lz \
2121
-o bin/deinterleave_generator
2222

23-
for archs in arm-32-android,armeabi arm-32-android-armv7s,armeabi-v7a arm-64-android,arm64-v8a x86-64-android-sse41,x86_64 x86-32-android,x86 ; do
23+
for archs in arm-32-android,armeabi arm-32-android-armv7s,armeabi-v7a arm-64-android,arm64-v8a x86-64-android-sse41,x86_64 x86-32-android,x86; do
2424
IFS=,
2525
set $archs
2626
HL_TARGET=$1
2727
ANDROID_ABI=$2
28-
mkdir -p bin/$ANDROID_ABI
29-
./bin/edge_detect_generator -g edge_detect -o bin/$ANDROID_ABI target=$HL_TARGET
30-
./bin/deinterleave_generator -g deinterleave -o bin/$ANDROID_ABI target=$HL_TARGET
28+
mkdir -p bin/"$ANDROID_ABI"
29+
./bin/edge_detect_generator -g edge_detect -o bin/"$ANDROID_ABI" target="$HL_TARGET"
30+
./bin/deinterleave_generator -g deinterleave -o bin/"$ANDROID_ABI" target="$HL_TARGET"
3131
unset IFS
3232
done
3333

34-
${ANDROID_NDK_HOME}/ndk-build NDK_GEN_OUT=./bin/gen NDK_LIBS_OUT=./bin/lib NDK_OUT=./bin/obj
34+
"${ANDROID_NDK_HOME}"/ndk-build NDK_GEN_OUT=./bin/gen NDK_LIBS_OUT=./bin/lib NDK_OUT=./bin/obj
3535
ant debug
3636
adb install -r bin/HelloAndroidCamera2-debug.apk
3737
adb logcat

apps/HelloBaremetal/cmake-external_project/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -eo pipefail
44
# Prerequisite :
55
# Halide is installed system-wide in your host machine or discoverable via CMAKE_PREFIX_PATH
66

7-
cd "$(dirname ${BASH_SOURCE[0]})"
7+
cd "$(dirname "${BASH_SOURCE[0]}")"
88
readonly TOOLCHAIN_FILE="${PWD}/../cmake/toolchain.noos-arm32-sample.cmake"
99

1010
rm -rf build
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22

3-
cd "$(dirname ${BASH_SOURCE[0]})"
3+
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
44
../run_baremetal.sh build/bin/add_filter ../../images/gray_small.pgm 16 build/out.pgm

apps/HelloBaremetal/cmake-super_build/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -eo pipefail
44
# Prerequisite :
55
# Halide is installed system-wide in your host machine or discoverable via CMAKE_PREFIX_PATH
66

7-
cd "$(dirname ${BASH_SOURCE[0]})"
7+
cd "$(dirname "${BASH_SOURCE[0]}")"
88
readonly TOOLCHAIN_FILE="${PWD}/../cmake/toolchain.noos-arm32-sample.cmake"
99

1010
rm -rf build
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22

3-
cd "$(dirname ${BASH_SOURCE[0]})"
3+
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
44
../run_baremetal.sh build/bin/add_filter ../../images/gray_small.pgm 16 build/out.pgm

apps/HelloBaremetal/cmake-twice/build.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -eo pipefail
44
# Prerequisite :
55
# Halide is installed system-wide in your host machine or discoverable via CMAKE_PREFIX_PATH
66

7-
cd "$(dirname ${BASH_SOURCE[0]})"
7+
cd "$(dirname "${BASH_SOURCE[0]}")"
88
readonly TOOLCHAIN_FILE="${PWD}/../cmake/toolchain.noos-arm32-sample.cmake"
99
readonly GEN_PACKAGE="HelloBaremetal-add_generator"
1010

@@ -22,8 +22,8 @@ cmake --build build-host/ --target "${GEN_PACKAGE}"
2222
# Build application with cross compiler,
2323
# where the generator executable built in Step 1 is just imported and called
2424
cmake -S . -B build-target \
25-
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \
26-
-DGEN_PACKAGE="${GEN_PACKAGE}" \
27-
-D${GEN_PACKAGE}_ROOT:FILEPATH=build-host
25+
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \
26+
-DGEN_PACKAGE="${GEN_PACKAGE}" \
27+
-D${GEN_PACKAGE}_ROOT:FILEPATH=build-host
2828

2929
cmake --build build-target/
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22

3-
cd "$(dirname ${BASH_SOURCE[0]})"
3+
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
44
../run_baremetal.sh build-target/add_filter ../../images/gray_small.pgm 16 build-target/out.pgm

apps/HelloBaremetal/run_baremetal.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ QEMU_MACHINE_ARGS="-M realview-pbx-a9 -cpu cortex-a9 -smp 1 -m 1024M"
1717
echo "Running command: $EXE_ARGS"
1818

1919
qemu-system-arm \
20-
${QEMU_MACHINE_ARGS} \
20+
"${QEMU_MACHINE_ARGS}" \
2121
-monitor null -serial null -nographic \
22-
-kernel ${EXECUTABLE} \
22+
-kernel "${EXECUTABLE}" \
2323
-semihosting -semihosting-config enable=on,target=native,arg="${EXE_ARGS}"
2424

2525
echo "Exit from QEMU"

0 commit comments

Comments
 (0)