[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master cd1448d 3/5: Improve shellcheck usage
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master cd1448d 3/5: Improve shellcheck usage |
Date: |
Sat, 9 May 2020 15:23:13 -0400 (EDT) |
branch: master
commit cd1448d790701f041dc9dccc91014a9afa23bbe9
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Improve shellcheck usage
* gui_test.sh: Explain why 'source="$srcdir"' wouldn't work.
* nychthemeral_test.sh: Likewise.
* gwc/invert.sh: Prior to shellcheck-0.4.6, global directives had to be
written on the first line after the shebang. Instead, reserve the first
comment line to state the script's purpose.
* lmi_setup_inc.sh: Improve comment, and write it in the canonical
position: immediately before the shellcheck directive it explains.
---
gui_test.sh | 2 ++
gwc/invert.sh | 2 +-
lmi_setup_inc.sh | 2 +-
nychthemeral_test.sh | 2 ++
4 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/gui_test.sh b/gui_test.sh
index e777d28..ecd9485 100755
--- a/gui_test.sh
+++ b/gui_test.sh
@@ -40,6 +40,8 @@ setopt PIPE_FAIL
srcdir=$(dirname "$(readlink --canonicalize "$0")")
+# Cannot recursively check script on path determined at runtime, so
+# a directive like 'source="$srcdir"' doesn't work.
# shellcheck disable=SC1090
. "$srcdir"/set_toolchain.sh
diff --git a/gwc/invert.sh b/gwc/invert.sh
index 31ae406..7e9a228 100755
--- a/gwc/invert.sh
+++ b/gwc/invert.sh
@@ -1,5 +1,4 @@
#!/bin/zsh
-# shellcheck disable=SC1036,SC2039
# Obfuscate-deobfuscate MST<->XST files. Cf. 'mst_to_xst.sh'.
@@ -32,6 +31,7 @@
# This script requires zsh because brace expansion is more convenient
# than 'seq', and especially because zsh offers glob qualifiers.
+# shellcheck disable=SC1036,SC2039
X=$(printf '\%03o' {255..0})
Y=$(printf '\%03o' {0..255})
diff --git a/lmi_setup_inc.sh b/lmi_setup_inc.sh
index 93d2c17..c10d588 100755
--- a/lmi_setup_inc.sh
+++ b/lmi_setup_inc.sh
@@ -25,8 +25,8 @@
# CHRTVER : local serial number (nothing to do with /etc/debian_version)
# CHRTNAME: physical name of chroot (SCHROOT_CHROOT_NAME)
+# Variables defined but unused here: this file should only be sourced.
# shellcheck disable=SC2034
-# (this file should only be sourced)
set -vx
diff --git a/nychthemeral_test.sh b/nychthemeral_test.sh
index 2d645d8..2bf2841 100755
--- a/nychthemeral_test.sh
+++ b/nychthemeral_test.sh
@@ -40,6 +40,8 @@ setopt PIPE_FAIL
srcdir=$(dirname "$(readlink --canonicalize "$0")")
+# Cannot recursively check script on path determined at runtime, so
+# a directive like 'source="$srcdir"' doesn't work.
# shellcheck disable=SC1090
. "$srcdir"/set_toolchain.sh