commit:     91283cf5b59a482061bf4cf440e774a0826c664b
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Jul 20 07:05:12 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jul 22 22:30:56 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=91283cf5

isolated-functions.sh: address two cases where shellcheck advises against let

As a matter of style, shellcheck recommends that the (( … )) compound
command be preferred over the let builtin for arithmetic. Presently, it
does so for two instances in which the let builtin is being used.

The first concerns the assert() function, where the builtin is used out
of necessity. Mute the recommendation there.

The second concerns the ebegin() function, where there is no need to use
the builtin. Have it use the (( … )) command instead.

See-also: 6f9971e54dab95c86f0eced52574a586916a5e4b
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/isolated-functions.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 806df45237..55053f5d32 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -23,6 +23,7 @@ fi
 shopt -s expand_aliases
 
 assert() {
+       # shellcheck disable=2219
        IFS='|' expression=${PIPESTATUS[*]} let '! expression' || die "$@"
 }
 
@@ -317,7 +318,7 @@ ebegin() {
        [[ ${RC_ENDCOL} == "yes" ]] && echo >&2
        LAST_E_LEN=$(( 3 + ${#RC_INDENTATION} + ${#msg} ))
        LAST_E_CMD="ebegin"
-       let ++__EBEGIN_EEND_COUNT
+       (( ++__EBEGIN_EEND_COUNT ))
        return 0
 }
 

Reply via email to