diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/lint.yml similarity index 55% rename from .github/workflows/shellcheck.yml rename to .github/workflows/lint.yml index a7822ad34..76a5d9688 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/lint.yml @@ -18,7 +18,4 @@ jobs: run: sudo apt install shellcheck - name: Lint sources with shellcheck run: | - # Recursively find all shell scripts in the build-scripts directory with a shebang - grep -Erl '^(#!/(bin|usr/bin)/(env )?(sh|bash))' build-scripts/ | while read -r file; do - shellcheck --external-sources --source-path=build-scripts "$file" - done + ./ci/lint.sh diff --git a/ci/lint.sh b/ci/lint.sh new file mode 100755 index 000000000..cf3856bd8 --- /dev/null +++ b/ci/lint.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +shellcheck_dirs() { + grep -Erl '^(#!/(bin|usr/bin)/(env )?(sh|bash))' "$1" | while read -r file; do + shellcheck --external-sources --source-path=build-scripts "$file" + done +} + +shellcheck_dirs build-scripts/ + +# some dirs are "dirty" aka need some work so don't fail on those yet +shellcheck_dirs ci/ packaging/ || true