]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
ci: shellcheck all directories with .sh
authorHarald Hoyer <harald@redhat.com>
Mon, 22 Mar 2021 08:14:20 +0000 (09:14 +0100)
committerHarald Hoyer <harald@hoyer.xyz>
Fri, 26 Mar 2021 08:35:30 +0000 (09:35 +0100)
.github/workflows/lint.yml
.shellcheckrc

index 8cefb44a1bd046c69a626d170178ad5239e7dd23..2f5d9106f59014b2c348f8d2600bd9039ae8f18b 100644 (file)
@@ -28,12 +28,21 @@ jobs:
     steps:
       - uses: actions/checkout@v2
 
-      - name: Run the sh-checker
+      - name: install tools
+        run: |
+          sudo apt-get install shellcheck
+          sudo wget "https://github.com/mvdan/sh/releases/download/v3.2.4/shfmt_v3.2.4_linux_amd64" \
+                    -O /usr/local/bin/shfmt
+          sudo chmod +x /usr/local/bin/shfmt
+
+      - name: shfmt
         uses: luizm/action-sh-checker@v0.1.13
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-          SHELLCHECK_OPTS: -e SC1004 # exclude some shellcheck warnings.
           SHFMT_OPTS: -s # arguments to shfmt.
         with:
           sh_checker_shellcheck_disable: true
           sh_checker_comment: true
+
+      - name: shellcheck on all marked directories
+        run: while read -r -d '' dir; do shellcheck $(shfmt -f $dir); done < <(find . -name .shchkdir -printf '%h\0')
index 0b0b5db19375b6e723db8b8b7305a8c212b13543..17909a1943a3d5ea7bf4052e6f2572dcd2ada117 100644 (file)
@@ -1,5 +1,19 @@
 # SC2039: In POSIX sh, 'local' is undefined.
+# https://github.com/koalaman/shellcheck/wiki/SC2039
 disable=SC2039
 
 # SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
+# https://github.com/koalaman/shellcheck/wiki/SC2166
 disable=SC2166
+
+# SC2154: Variable is referenced but not assigned
+# https://github.com/koalaman/shellcheck/wiki/SC2154
+disable=SC2154
+
+# SC1091: Not following <file>
+# https://github.com/koalaman/shellcheck/wiki/SC1091
+disable=SC1091
+
+# SC2174: When used with -p, -m only applies to the deepest directory.
+# https://github.com/koalaman/shellcheck/wiki/SC2174
+disable=SC2174