check_format: Fixes for shellcheck's SC2155 directive

This is a first commit in the series addressing potential Bash issues
as discovered by the latest shellcheck release (0.7.2, shipped with
the very latest fedora33 and fedora34). The goal is to either fix,
locally or globally disable given directive(s).

SC2155: Declare and assign separately to avoid masking return values

Simplify the setting of the variable pointing at the root of the repo.
Also, keep it consistent with the rest of the scripts and declare it as
$rootdir.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I63e0b1a85ce16f7983e9ba6dd985046e8a39a650
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8500
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Michal Berger 2021-06-24 15:53:04 +02:00 committed by Jim Harris
parent 79b6771f61
commit 36f5f0df17

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash
readonly BASEDIR=$(readlink -f $(dirname $0))/..
source "$BASEDIR/scripts/common.sh"
rootdir=$(readlink -f "$(dirname "$0")")/..
source "$rootdir/scripts/common.sh"
cd $BASEDIR
cd "$rootdir"
# exit on errors
set -e