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>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8500 (master)

(cherry picked from commit 36f5f0df171607ed0a1df296413de72fba5a7330)
Change-Id: I63e0b1a85ce16f7983e9ba6dd985046e8a39a650
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9833
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Michal Berger 2021-06-24 15:53:04 +02:00 committed by Tomasz Zawadzki
parent 731887d713
commit 93b2a5420a

View File

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