diff --git a/.drone.yml b/.drone.yml index e3a3de1..c637bb1 100644 --- a/.drone.yml +++ b/.drone.yml @@ -82,6 +82,12 @@ steps: commands: - ./tools/ci/static_analysis/clang_tidy.sh +- name: shell check + image: ci:latest + pull: if-not-exists + commands: + - ./tools/ci/static_analysis/shell_check.sh + - name: clang format image: ci:latest pull: if-not-exists diff --git a/tools/ci/static_analysis/shell_check.sh b/tools/ci/static_analysis/shell_check.sh new file mode 100755 index 0000000..c4d21d4 --- /dev/null +++ b/tools/ci/static_analysis/shell_check.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -euo pipefail +cd "$(git rev-parse --show-toplevel)/" + +has_shellcheck_issues=0 +while IFS= read -r -d '' file; do + echo "Checking shell script $file" + + if ! shellcheck "$file"; then + echo "❌ Shellcheck issue detected in $file" + has_shellcheck_issues=1 + fi +done < <(find ./modules ./tools -name '*.sh' -print0) + +if [ "$has_shellcheck_issues" -eq 0 ]; then + echo "✅ All files are properly shellchecked! Well done! ^~^" +fi +exit ${has_shellcheck_issues}