build: gen-version-i.sh: make shellcheck-clean
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 26 May 2023 12:35:37 +0000 (08:35 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 31 Aug 2023 14:38:42 +0000 (10:38 -0400)
commit385ba368d241b12488277e191661a272d2c27d25
tree1a72ba4f6c2076b136f7c23baf525aad309a673d
parent90eb03801a1098801d04988a2e4bf477c7bf5103
build: gen-version-i.sh: make shellcheck-clean

Fix all the warnings below.

    In src/common/gen-version-i.sh line 27:
    if (test ! -f version.i && test -f "$TOP_SRCDIR/include/version.i"); then
       ^-- SC2233 (style): Remove superfluous (..) around condition to avoid subshell overhead.

    In src/common/gen-version-i.sh line 39:
    if (test -r "$TOP_SRCDIR/bootstrap" && test -r "$TOP_SRCDIR/.git") &&
       ^-- SC2235 (style): Use { ..; } instead of (..) to avoid subshell overhead.

    In src/common/gen-version-i.sh line 40:
     test -x "`which git 2>&1;true`"; then
                             ^-------------------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

    Did you mean:
     test -x "$(which git 2>&1;true)"; then

    In src/common/gen-version-i.sh line 41:
     GIT_VERSION_STR="`cd "$TOP_SRCDIR" && git describe --tags --dirty`"
                             ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

    Did you mean:
     GIT_VERSION_STR="$(cd "$TOP_SRCDIR" && git describe --tags --dirty)"

    In src/common/gen-version-i.sh line 42:
     GIT_CURRENT_TAG="`cd "$TOP_SRCDIR" && git describe --tags --exact-match --match="v[0-9]*" HEAD || true 2> /dev/null`"
                             ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`.
                                               ^-- SC2015 (info): Note that A && B || C is not if-then-else. C may run when A is true.

    Did you mean:
     GIT_CURRENT_TAG="$(cd "$TOP_SRCDIR" && git describe --tags --exact-match --match="v[0-9]*" HEAD || true 2> /dev/null)"

    In src/common/gen-version-i.sh line 64:
    echo "#define BT_VERSION_EXTRA_NAME \"`$SED -n '1p' "$TOP_SRCDIR/version/extra_version_name" 2> /dev/null`\"" >> version.i.tmp
    ^-- SC2129 (style): Consider using { cmd1; cmd2; } >> file instead of individual redirects.
                                          ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

    Did you mean:
    echo "#define BT_VERSION_EXTRA_NAME \"$($SED -n '1p' "$TOP_SRCDIR/version/extra_version_name" 2> /dev/null)\"" >> version.i.tmp

    In src/common/gen-version-i.sh line 70:
    echo "#define BT_VERSION_EXTRA_DESCRIPTION \"`$SED -E ':a ; N ; $!ba ; s/[^a-zA-Z0-9 \n\t\.,]/-/g ; s/\r{0,1}\n/\\\n/g' "$TOP_SRCDIR/version/extra_version_description" 2> /dev/null`\"" >> version.i.tmp
                                                 ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

    Did you mean:
    echo "#define BT_VERSION_EXTRA_DESCRIPTION \"$($SED -E ':a ; N ; $!ba ; s/[^a-zA-Z0-9 \n\t\.,]/-/g ; s/\r{0,1}\n/\\\n/g' "$TOP_SRCDIR/version/extra_version_description" 2> /dev/null)\"" >> version.i.tmp

    In src/common/gen-version-i.sh line 80:
    echo "#define BT_VERSION_EXTRA_PATCHES \"`ls -1 "$TOP_SRCDIR/version/extra_patches" | $GREP -v '^README.adoc' | $SED -E ':a ; N ; $!ba ; s/[^a-zA-Z0-9 \n\t\.]/-/g ; s/\r{0,1}\n/\\\n/g' 2> /dev/null`\"" >> version.i.tmp
                                             ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`.
                                              ^-- SC2012 (info): Use find instead of ls to better handle non-alphanumeric filenames.

    Did you mean:
    echo "#define BT_VERSION_EXTRA_PATCHES \"$(ls -1 "$TOP_SRCDIR/version/extra_patches" | $GREP -v '^README.adoc' | $SED -E ':a ; N ; $!ba ; s/[^a-zA-Z0-9 \n\t\.]/-/g ; s/\r{0,1}\n/\\\n/g' 2> /dev/null)\"" >> version.i.tmp

    In src/common/gen-version-i.sh line 87:
     test x"`cat version.i.tmp`" != x"`cat version.i`"; then
                           ^-----------------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.
                                                     ^-------------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

    Did you mean:
     test x"$(cat version.i.tmp)" != x"$(cat version.i)"; then

    For more information:
      https://www.shellcheck.net/wiki/SC2012 -- Use find instead of ls to better ...
      https://www.shellcheck.net/wiki/SC2015 -- Note that A && B || C is not if-t...
      https://www.shellcheck.net/wiki/SC2006 -- Use $(...) notation instead of le...

Change-Id: I519fd427b248bc8f460aa1e5b592aed0ea6858c2
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10096
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
src/common/gen-version-i.sh
This page took 0.025543 seconds and 4 git commands to generate.