Skip to content

Commit 1fab95e

Browse files
committed
fix shellcheck issues and add CI (#2)
Signed-off-by: Harmen Stoppels <me@harmenstoppels.nl>
1 parent 38a5ab4 commit 1fab95e

3 files changed

Lines changed: 28 additions & 3 deletions

File tree

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly

.github/workflows/shellcheck.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: shellcheck
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
8+
jobs:
9+
shellcheck:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
13+
- name: Run shellcheck
14+
run: shellcheck cc.sh

cc.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ execute() {
196196
output_log="$SPACK_DEBUG_LOG_DIR/spack-cc-$SPACK_DEBUG_LOG_ID.out.log"
197197
echo "[$mode] $command $input_command" >> "$input_log"
198198
IFS="$lsep"
199+
# shellcheck disable=SC2086
199200
echo "[$mode] "$full_command_list >> "$output_log"
200201
unset IFS
201202
fi
@@ -437,9 +438,10 @@ export PATH="$new_dirs"
437438

438439
if [ "$mode" = vcheck ]; then
439440
full_command_list="$command"
440-
args="$@"
441441
extend full_command_list vcheck_flags
442-
extend full_command_list args
442+
for arg in "$@"; do
443+
append full_command_list "$arg"
444+
done
443445
execute
444446
fi
445447

@@ -580,6 +582,7 @@ categorize_arguments() {
580582
eval "\
581583
stripped=\"\${1##$before}\"
582584
"
585+
# shellcheck disable=SC2154 # shellcheck doesn't see eval
583586
if [ "$stripped" = "$1" ] ; then
584587
continue
585588
fi
@@ -633,6 +636,7 @@ categorize_arguments() {
633636
;;
634637
-Wl,*)
635638
IFS=,
639+
# shellcheck disable=SC2086 # intentional splitting
636640
if ! parse_Wl ${1#-Wl,}; then
637641
append return_other_args_list "$1"
638642
fi
@@ -803,7 +807,8 @@ case "$mode" in
803807
esac
804808

805809
IFS="$lsep"
806-
categorize_arguments $spack_flags_list
810+
# shellcheck disable=SC2086 # intentional splitting
811+
categorize_arguments $spack_flags_list
807812
unset IFS
808813

809814
assign_path_lists spack_flags_isystem_include_dirs_list return_isystem_include_dirs_list

0 commit comments

Comments
 (0)