Skip to content

Commit fb50d97

Browse files
committed
fix: shellcheck + housekeeping
1 parent 02a2f58 commit fb50d97

4 files changed

Lines changed: 12 additions & 10 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ bench:
8585
.PHONY: tidy
8686
tidy:
8787
find src/ tests/ benchmarks/ \( -name '*.cpp' -o -name '*.hpp' -o -name '*.c' -o -name '*.h' \) -exec clang-format -i {} +
88-
hooks/check_clang_tidy.sh
8988
hooks/check_shell.sh
89+
hooks/check_clang_tidy.sh
9090

9191
## run-debug: 🏃‍♂️ run the app (debug) (don't forget `withenv`)
9292
.PHONY: run-debug

hooks/pre-commit

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1313

1414
# Run subscripts
1515

16-
echo "Running strict pre-commit checks (clang-tidy, clang-format, build-debug)..."
16+
echo "Running strict pre-commit checks (clang-format, shellcheck, clang-tidy, build-debug)..."
17+
18+
bash "$DIR/check_clang_format.sh"
19+
20+
bash "$DIR/check_shell.sh"
1721

1822
# TODO(mils): does this also need to be converted to:
1923
# `git diff -U0 origin/master...HEAD -- '*.cpp'`
2024
git diff -U0 master...HEAD -- '*.cpp' | \
2125
clang-tidy-diff-18.py -p1 -path "$DIR/../build/Debug"
2226

23-
bash "$DIR/check_clang_format.sh"
24-
2527
make build-debug
2628

2729
echo "✅ Pre-commit checks passed on full codebase."

scripts/pin_cpus.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ nodes_used=$(for cpu in $(expand_cpu_range "$CPU_SET_RANGE"); do
5555
cpulist_file="$node_dir/cpulist"
5656
[[ -f $cpulist_file ]] || continue
5757
if grep -qE "(^|,)$cpu($|,|-)" "$cpulist_file"; then
58-
echo "$(basename "$node_dir" | sed 's/node//')"
58+
basename "$node_dir" | sed 's/node//'
5959
fi
6060
done
6161
done | sort -u)

scripts/pin_irqs.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ cpu_to_mask() {
3838
IFS=',' read -ra parts <<< "$1"
3939
for part in "${parts[@]}"; do
4040
if [[ $part =~ ^([0-9]+)-([0-9]+)$ ]]; then
41-
for ((i=${BASH_REMATCH[1]}; i<=${BASH_REMATCH[2]}; i++)); do
42-
cpus+=($i)
41+
for ((i=BASH_REMATCH[1]; i<=BASH_REMATCH[2]; i++)); do
42+
cpus+=("$i")
4343
done
4444
else
45-
cpus+=($part)
45+
cpus+=("$part")
4646
fi
4747
done
4848

@@ -62,7 +62,7 @@ for irq in /proc/irq/*/smp_affinity; do
6262
[[ -f $irq ]] || continue
6363
# Check if writable
6464
if [[ ! -w "$irq" ]]; then
65-
echo "skipping IRQ, smp_affinity not writable. IRQ [$(basename $(dirname $irq))]"
65+
echo "skipping IRQ, smp_affinity not writable. IRQ [$(basename "$(dirname "$irq")")]"
6666
continue
6767
fi
6868
# read current mask
@@ -75,7 +75,7 @@ for irq in /proc/irq/*/smp_affinity; do
7575
new_hex=$(printf "%x" "$new_dec")
7676
# only write if different
7777
if [[ "$current" != "$new_hex" ]]; then
78-
echo "moving IRQ off isolated CPUs. IRQ [$(basename $(dirname $irq))] old [$current] new [$new_hex]"
78+
echo "moving IRQ off isolated CPUs. IRQ [$(basename "$(dirname "$irq")")] old [$current] new [$new_hex]"
7979
echo "$new_hex" > "$irq"
8080
fi
8181
done

0 commit comments

Comments
 (0)