Skip to content

Commit

Permalink
make shellcheck emit all errors found and check for tab indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cartercanedy committed Sep 23, 2024
1 parent cd90bc0 commit 987d9a8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,21 @@ jobs:
- name: Run shellcheck
run: |
error=0
for file in $(git diff --name-only origin/${{ github.base_ref }} HEAD core/tabs); do
if [[ "$file" == *.sh ]] && [[ -f "$file" ]]; then
./shellcheck-v0.10.0/shellcheck -S error "$file"
errors="$(shellcheck -fgcc -Serror "$file" | sed -n 's/\(.\+\)\:\([0-9]\+\)\:\([0-9]\+\)\: \(.*\)/::error file=\1,line=\2,col=\3::\4/p' | sed 's/ /:space:/g')"
# ^--------- emit errors --------^ ^------------------ reformat info into gh action toolkit fn invocation ------------------^ ^ replace spaces ^
for error in $errors; do
echo "$error" | sed 's/:space:/ /g'
error=1
done
errors="$(grep -nP '^\t+\w+' "$file" | sed -n 's,\([0-9]\+\).*,::error file='"$file"'\,line=\1::Found tab indentations,p' | sed 's/ /:space:/g')"
for error in $errors; do
echo "$error" | sed 's/:space:/ /g'
error=1
done
fi
done
exit $error

0 comments on commit 987d9a8

Please sign in to comment.