From 598e1b232d090369c7d74af1c0a2174e3a6d218a Mon Sep 17 00:00:00 2001 From: light7734 Date: Thu, 16 Oct 2025 14:31:54 +0330 Subject: [PATCH] ci: add shell check --- .drone.yml | 6 ++++++ tools/ci/static_analysis/shell_check.sh | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100755 tools/ci/static_analysis/shell_check.sh 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}