summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKerin Millar <kfm@plushkava.net>2024-08-10 07:57:17 +0100
committerSam James <sam@gentoo.org>2024-08-11 11:11:05 +0100
commit8f708ef54a07f200b308f82fd64c2c87f5e89b11 (patch)
treed1b0da9a47583b7e1e182c7439182470314578b1 /functions
parentExempt _should_throttle() from shellcheck SC2317 (diff)
downloadgentoo-functions-8f708ef54a07f200b308f82fd64c2c87f5e89b11.tar.gz
gentoo-functions-8f708ef54a07f200b308f82fd64c2c87f5e89b11.tar.bz2
gentoo-functions-8f708ef54a07f200b308f82fd64c2c87f5e89b11.zip
Remedy false positives in categories SC2034 and SC2154
Signed-off-by: Kerin Millar <kfm@plushkava.net> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'functions')
-rw-r--r--functions/experimental.sh1
-rw-r--r--functions/rc.sh8
2 files changed, 9 insertions, 0 deletions
diff --git a/functions/experimental.sh b/functions/experimental.sh
index 0ca9904..7c2fb25 100644
--- a/functions/experimental.sh
+++ b/functions/experimental.sh
@@ -168,6 +168,7 @@ str_between()
else
set -- "$2" "$1" "$3"
i=0
+ # shellcheck disable=2034
printf '%s\n' "$@" |
sort |
while IFS= read -r line; do
diff --git a/functions/rc.sh b/functions/rc.sh
index 4eff3c8..101b99e 100644
--- a/functions/rc.sh
+++ b/functions/rc.sh
@@ -347,6 +347,7 @@ _eend()
"${efunc}" "${msg}"
fi
# Generate an indicator for ebegin's unsuccessful conclusion.
+ # shellcheck disable=2154
if _update_tty_level <&1; [ "${genfun_tty}" -eq 0 ]; then
msg="[ !! ]"
else
@@ -356,6 +357,7 @@ _eend()
return "${retval}"
else
# Generate an indicator for ebegin's successful conclusion.
+ # shellcheck disable=2154
if _update_tty_level <&1; [ "${genfun_tty}" -eq 0 ]; then
msg="[ ok ]"
else
@@ -367,6 +369,7 @@ _eend()
# Save the cursor position with DECSC, move it up by one line
# with CUU, position it horizontally with CHA, print the
# indicator, then restore the cursor position with DECRC.
+ # shellcheck disable=2154
col=$(( genfun_cols > 6 ? genfun_cols - 6 : 1 ))
printf '\0337\033[1A\033[%dG %s\0338' "$(( col + genfun_offset ))" "${msg}"
else
@@ -484,5 +487,10 @@ else
genfun_offset=0
fi
+# Assign the LF ('\n') character for later expansion. POSIX-1.2024 permits $'\n'
+# but it may take years for it to be commonly implemented.
+genfun_newline='
+'
+
# shellcheck disable=2034
RC_GOT_FUNCTIONS=yes