*: Use -n instead of ! -z. [SC2236]

Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
release-3.4
Sam Batschelet 2019-01-08 17:02:40 +00:00 committed by Sam Batschelet
parent 442c863413
commit 2001786f02
2 changed files with 8 additions and 8 deletions

4
build
View File

@ -5,7 +5,7 @@ ORG_PATH="go.etcd.io"
REPO_PATH="${ORG_PATH}/etcd"
GIT_SHA=$(git rev-parse --short HEAD || echo "GitNotFound")
if [[ ! -z "$FAILPOINTS" ]]; then
if [[ -n "$FAILPOINTS" ]]; then
GIT_SHA="$GIT_SHA"-FAILPOINTS
fi
@ -42,7 +42,7 @@ etcd_setup_gopath() {
toggle_failpoints_default() {
mode="disable"
if [[ ! -z "$FAILPOINTS" ]]; then mode="enable"; fi
if [[ -n "$FAILPOINTS" ]]; then mode="enable"; fi
toggle_failpoints "$mode"
}

12
test
View File

@ -115,7 +115,7 @@ fi
# determine the number of CPUs to use for Go tests
TEST_CPUS="1,2,4"
if [ ! -z "${CPU}" ]; then
if [ -n "${CPU}" ]; then
TEST_CPUS="${CPU}"
fi
echo "Running with TEST_CPUS:" "${TEST_CPUS}"
@ -126,7 +126,7 @@ if [ "$GOARCH" == "amd64" ]; then
fi
RUN_ARG=""
if [ ! -z "${TESTCASE}" ]; then
if [ -n "${TESTCASE}" ]; then
RUN_ARG="-run=${TESTCASE}"
fi
@ -381,7 +381,7 @@ function shellcheck_pass {
function markdown_you_pass {
# eschew you
yous=$(find . -name \*.md ! -path './vendor/*' ! -path './Documentation/v2/*' ! -path './gopath.proto/*' -exec grep -E --color "[Yy]ou[r]?[ '.,;]" {} + || true)
if [ ! -z "$yous" ]; then
if [ -n "$yous" ]; then
echo -e "found 'you' in documentation:\\n${yous}"
exit 255
fi
@ -413,13 +413,13 @@ function goword_pass {
gofiles=($gofiles)
# only check for broken exported godocs
gowordRes=$(goword -use-spell=false "${gofiles[@]}" | grep godoc-export | sort)
if [ ! -z "$gowordRes" ]; then
if [ -n "$gowordRes" ]; then
echo -e "goword checking failed:\\n${gowordRes}"
exit 255
fi
# check some spelling
gowordRes=$(goword -ignore-file=.words clientv3/{*,*/*}.go 2>&1 | grep spell | sort)
if [ ! -z "$gowordRes" ]; then
if [ -n "$gowordRes" ]; then
echo -e "goword checking failed:\\n${gowordRes}"
exit 255
fi
@ -663,7 +663,7 @@ function dep_pass {
badpkg="(etcdserver$|mvcc$|backend$|grpc-gateway)"
deps=$(go list -f '{{ .Deps }}' | sed 's/ /\n/g' | grep -E "${badpkg}" || echo "")
popd >/dev/null
if [ ! -z "$deps" ]; then
if [ -n "$deps" ]; then
echo -e "clientv3 has masked dependencies:\\n${deps}"
exit 255
fi