Skip to content

Commit cfacf12

Browse files
committed
fix(ci/shellcheck): pass --shell=bash for per-file lint of board configs
The per-file ShellCheck loops in maintenance-lint-scripts.yml gate invocation behind `grep -qE '^#!/.*bash' "$file"`, but grep scans every line — so any board .conf with an embedded `#!/bin/bash` heredoc (e.g. config/boards/easepi-a2.conf at lines 267/289/496) passes the gate. The follow-up shellcheck call ran without --shell=bash, so it looked at line 1 (a `# Rockchip ...` comment), couldn't determine the target shell, and errored: In config/boards/easepi-a2.conf line 1: ^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive. Add --shell=bash to both call sites (findings artifact + red-cross gate). ShellCheck now knows the shell up front, SC2148 no longer fires on line 1, and the embedded heredocs inside the .conf still get linted as bash.
1 parent 45561f2 commit cfacf12

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

.github/workflows/maintenance-lint-scripts.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
[[ -f "$file" ]] || continue
109109
if [[ ! "$file" =~ lib/|extensions/|\.py$|\.service$|\.rules$|\.network$|\.netdev$ ]]; then
110110
if grep -qE '^#!/.*bash' "$file" 2>/dev/null; then
111-
"$SC" --severity=error --format=gcc "$file" >> shellcheck-findings.txt 2>&1 || true
111+
"$SC" --shell=bash --severity=error --format=gcc "$file" >> shellcheck-findings.txt 2>&1 || true
112112
fi
113113
fi
114114
done
@@ -193,7 +193,7 @@ jobs:
193193
[[ -f "$file" ]] || continue
194194
if [[ ! "$file" =~ lib/|extensions/|\.py$|\.service$|\.rules$|\.network$|\.netdev$ ]]; then
195195
if grep -qE '^#!/.*bash' "$file" 2>/dev/null; then
196-
shellcheck --severity=error "$file" || ret=$?
196+
shellcheck --shell=bash --severity=error "$file" || ret=$?
197197
fi
198198
fi
199199
done

0 commit comments

Comments
 (0)