From 1fcdf63c4e58d15768ba3538d7bc029cd052f26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Pe=C4=8Dovnik?= Date: Wed, 15 Mar 2023 16:22:14 +0100 Subject: [PATCH] Look only for bash shebang (#4928) * Look only for bash shebang We have some Python scripts now so we need to move that out * Extend script to cover ignored files and use internal tool for checking the rest Signed-off-by: Igor --------- Signed-off-by: Igor --- .github/workflows/lint-scripts-pr.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint-scripts-pr.yml b/.github/workflows/lint-scripts-pr.yml index c574a7b09c..d013e42cac 100644 --- a/.github/workflows/lint-scripts-pr.yml +++ b/.github/workflows/lint-scripts-pr.yml @@ -32,14 +32,25 @@ jobs: - name: List all changed files run: | + # use framework internal mechanism for checking `lib` and `extensions` code only one file is passed, + # and source's are followed, thus the whole project is "understood" by shellcheck. + # For example, when checking individual files, one variable might be thought "unused" because it + # is only used in another file, which does not happen when done properly. + + bash lib/tools/shellcheck.sh + ret=0 for file in ${{ steps.changed-files.outputs.all_changed_files }}; do - if grep -qE "^#\!/" $file; then - shellcheck --severity=error $file || ret=$? + if [[ ! "${file}" =~ lib/|extensions/|.py|.service|.rules|.network|.netdev ]]; then + if grep -qE "^#\!/.*bash" $file; then + + shellcheck --severity=error $file || ret=$? + + fi + fi - fi done exit $ret