]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
Scripts: Add shellcheck directives to silence warnings
authorLasse Collin <lasse.collin@tukaani.org>
Tue, 13 May 2025 17:42:26 +0000 (20:42 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Sat, 24 May 2025 09:41:51 +0000 (12:41 +0300)
Set also shell because the xz*.in files start with '#!@POSIX_SHELL@'.

SC1003 and SC2016 are only info messages, not warnings. Several other
shellcheck info messages remain. They are safe to ignore, but I didn't
want to disable them now.

Partially-fixes: https://github.com/tukaani-project/xz/issues/174

src/scripts/xzdiff.in
src/scripts/xzgrep.in
src/scripts/xzless.in
src/scripts/xzmore.in

index 174347a43e4ba96506f19726ad8c5759b79953e4..8e1e0a22ca0eb25fe43452195fbf8c1c9c207a2e 100644 (file)
@@ -16,6 +16,8 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
+# shellcheck shell=sh disable=SC1003,SC2016
+
 @enable_path_for_scripts@
 #SET_PATH - This line is a placeholder to ease patching this script.
 
@@ -90,6 +92,8 @@ if test $# -eq 1; then
       printf '%s\n' "$0: $1: Unknown compressed file name suffix" >&2
       exit 2;;
   esac
+  # The FILE variable is used with eval, and shellcheck doesn't see that.
+  # shellcheck disable=SC2034
   case $1 in
     *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *[-.]lzo | *[-.]zst | *[-.]lz4)
       FILE=`expr "X$1" : 'X\(.*\)[-.][abglmostxzZ24]*$'`;;
index c9cd02d07c4129dc130275cf8b4edfcb89fa9ab3..511ea39c7fd6eed452372ad2fa54fd01444b0835 100644 (file)
@@ -19,6 +19,8 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
+# shellcheck shell=sh disable=SC1003,SC2016
+
 @enable_path_for_scripts@
 #SET_PATH - This line is a placeholder to ease patching this script.
 
index 6346966bf8e28b1f7f4eb08bc775321cdd6d2a3b..47f5b0b2ed7099b8c759e65007d8b8bafa360b05 100644 (file)
@@ -16,6 +16,8 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
+# shellcheck shell=sh disable=SC2089,SC2090
+
 @enable_path_for_scripts@
 #SET_PATH - This line is a placeholder to ease patching this script.
 
index fc8b93a35094b8a04c97969a4db3e51a43cadfc4..a2bf13bca06d27f4beb9cc49ecad8165de02979e 100644 (file)
@@ -16,6 +16,8 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
+# shellcheck shell=sh
+
 @enable_path_for_scripts@
 #SET_PATH - This line is a placeholder to ease patching this script.