Skip to content

Commit

Permalink
*: Use -n instead of ! -z. [SC2236]
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Batschelet <[email protected]>
  • Loading branch information
hexfusion committed Jan 8, 2019
1 parent 442c863 commit 2001786
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"
}

Expand Down
12 changes: 6 additions & 6 deletions test
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -126,7 +126,7 @@ if [ "$GOARCH" == "amd64" ]; then
fi

RUN_ARG=""
if [ ! -z "${TESTCASE}" ]; then
if [ -n "${TESTCASE}" ]; then
RUN_ARG="-run=${TESTCASE}"
fi

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2001786

Please sign in to comment.