diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 0000000..2da775a --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,21 @@ +name: ShellCheck +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +jobs: + shellcheck: + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + steps: + - + name: Checkout repository + uses: actions/checkout@v4.2.2 + with: + fetch-depth: 0 # Differential ShellCheck requires full git history + + - name: Differential ShellCheck + uses: redhat-plumbers-in-action/differential-shellcheck@v5 + with: + severity: warning + display-engine: sarif-fmt diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 0000000..c4711a8 --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1,6 @@ +external-sources=true # allow shellcheck to read external sources +disable=SC3043 #disable SC3043: In POSIX sh, local is undefined. +enable=useless-use-of-cat # disabled by default as of shellcheck 0.11.0 +enable=avoid-negated-conditions # avoid-negated-conditions is optional as of shellcheck 0.11.0 +enable=require-variable-braces +enable=deprecate-which diff --git a/padd.sh b/padd.sh index e9dd14a..982bf95 100755 --- a/padd.sh +++ b/padd.sh @@ -1,9 +1,4 @@ #!/usr/bin/env sh -# shellcheck disable=SC1091 - -# Ignore warning about `local` being undefinded in POSIX -# shellcheck disable=SC3043 -# https://github.com/koalaman/shellcheck/wiki/SC3043#exceptions # PADD # A more advanced version of the chronometer provided with Pihole