From 36f5f0df171607ed0a1df296413de72fba5a7330 Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Thu, 24 Jun 2021 15:53:04 +0200 Subject: [PATCH] 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 Change-Id: I63e0b1a85ce16f7983e9ba6dd985046e8a39a650 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8500 Tested-by: SPDK CI Jenkins Reviewed-by: Karol Latecki Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- scripts/check_format.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/check_format.sh b/scripts/check_format.sh index a9e598136..2e451344a 100755 --- a/scripts/check_format.sh +++ b/scripts/check_format.sh @@ -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