You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@yetus.apache.org by aw...@apache.org on 2016/04/17 19:09:36 UTC

[5/5] yetus git commit: YETUS-65. fix shellcheck 4.1 errors

YETUS-65. fix shellcheck 4.1 errors

Signed-off-by: Sean Busbey <bu...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/yetus/repo
Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/14cae37c
Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/14cae37c
Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/14cae37c

Branch: refs/heads/master
Commit: 14cae37c6148e92c6015a090a6ae327b1cd8574d
Parents: 585e97d
Author: Allen Wittenauer <aw...@apache.org>
Authored: Thu Apr 14 08:45:48 2016 -0700
Committer: Allen Wittenauer <aw...@apache.org>
Committed: Sun Apr 17 10:09:21 2016 -0700

----------------------------------------------------------------------
 precommit/core.d/00-yetuslib.sh      |  2 ++
 precommit/smart-apply-patch.sh       |  2 +-
 precommit/test-patch.d/bugzilla.sh   |  2 --
 precommit/test-patch.d/shellcheck.sh |  2 +-
 precommit/test-patch.sh              | 10 ++++++----
 5 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/yetus/blob/14cae37c/precommit/core.d/00-yetuslib.sh
----------------------------------------------------------------------
diff --git a/precommit/core.d/00-yetuslib.sh b/precommit/core.d/00-yetuslib.sh
index 1bd63b7..90ffa16 100755
--- a/precommit/core.d/00-yetuslib.sh
+++ b/precommit/core.d/00-yetuslib.sh
@@ -139,6 +139,7 @@ function yetus_add_header
 {
   declare text=$1
 
+  #shellcheck disable=SC2034
   YETUS_USAGE_HEADER="${text}"
 }
 
@@ -163,6 +164,7 @@ function yetus_add_option
 ## @replaceable  no
 function yetus_reset_usage
 {
+  # shellcheck disable=SC2034
   YETUS_OPTION_USAGE=()
   YETUS_OPTION_USAGE_COUNTER=0
 }

http://git-wip-us.apache.org/repos/asf/yetus/blob/14cae37c/precommit/smart-apply-patch.sh
----------------------------------------------------------------------
diff --git a/precommit/smart-apply-patch.sh b/precommit/smart-apply-patch.sh
index de0a643..463c343 100755
--- a/precommit/smart-apply-patch.sh
+++ b/precommit/smart-apply-patch.sh
@@ -16,7 +16,7 @@
 
 # Make sure that bash version meets the pre-requisite
 
-if [[ -z "${BASH_VERSINFO}" ]] \
+if [[ -z "${BASH_VERSINFO[0]}" ]] \
    || [[ "${BASH_VERSINFO[0]}" -lt 3 ]] \
    || [[ "${BASH_VERSINFO[0]}" -eq 3 && "${BASH_VERSINFO[1]}" -lt 2 ]]; then
   echo "bash v3.2+ is required. Sorry."

http://git-wip-us.apache.org/repos/asf/yetus/blob/14cae37c/precommit/test-patch.d/bugzilla.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/bugzilla.sh b/precommit/test-patch.d/bugzilla.sh
index 885a752..9d04a04 100755
--- a/precommit/test-patch.d/bugzilla.sh
+++ b/precommit/test-patch.d/bugzilla.sh
@@ -40,8 +40,6 @@ function bugzilla_parse_args
 function bugzilla_determine_issue
 {
   declare input=$1
-  declare patchnamechunk
-  declare maybeissue
 
   if [[ ! "${input}" =~ ^BZ: ]]; then
     return 1

http://git-wip-us.apache.org/repos/asf/yetus/blob/14cae37c/precommit/test-patch.d/shellcheck.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/shellcheck.sh b/precommit/test-patch.d/shellcheck.sh
index fd5109f..f3d8fbd 100755
--- a/precommit/test-patch.d/shellcheck.sh
+++ b/precommit/test-patch.d/shellcheck.sh
@@ -52,7 +52,7 @@ function shellcheck_private_findbash
   local value
   local list
 
-  while read line; do
+  while read -r line; do
     value=$(find "${line}" ! -name '*.cmd' -type f \
       | ${GREP} -E -v '(.orig$|.rej$)')
 

http://git-wip-us.apache.org/repos/asf/yetus/blob/14cae37c/precommit/test-patch.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.sh b/precommit/test-patch.sh
index d840f32..0260c59 100755
--- a/precommit/test-patch.sh
+++ b/precommit/test-patch.sh
@@ -16,7 +16,7 @@
 
 # Make sure that bash version meets the pre-requisite
 
-if [[ -z "${BASH_VERSINFO}" ]] \
+if [[ -z "${BASH_VERSINFO[0]}" ]] \
    || [[ "${BASH_VERSINFO[0]}" -lt 3 ]] \
    || [[ "${BASH_VERSINFO[0]}" -eq 3 && "${BASH_VERSINFO[1]}" -lt 2 ]]; then
   echo "bash v3.2+ is required. Sorry."
@@ -933,14 +933,14 @@ function parse_args
   fi
 
   # we need absolute dir for ${BASEDIR}
-  cd "${STARTINGDIR}"
+  cd "${STARTINGDIR}" || cleanup_and_exit 1
   BASEDIR=$(yetus_abs "${BASEDIR}")
 
   if [[ -n ${USER_PATCH_DIR} ]]; then
     PATCH_DIR="${USER_PATCH_DIR}"
   fi
 
-  cd "${STARTINGDIR}"
+  cd "${STARTINGDIR}" || cleanup_and_exit 1
   if [[ ! -d ${PATCH_DIR} ]]; then
     mkdir -p "${PATCH_DIR}"
     if [[ $? == 0 ]] ; then
@@ -1177,7 +1177,7 @@ function git_checkout
 
   big_console_header "Confirming git environment"
 
-  cd "${BASEDIR}"
+  cd "${BASEDIR}" || cleanup_and_exit 1
   if [[ ! -d .git ]]; then
     yetus_error "ERROR: ${BASEDIR} is not a git repo."
     cleanup_and_exit 1
@@ -2515,7 +2515,9 @@ function generic_postlog_compare
     generic_logfilter "${testtype}" "${PATCH_DIR}/branch-${origlog}-${fn}.txt" "${PATCH_DIR}/branch-${origlog}-${testtype}-${fn}.txt"
     generic_logfilter "${testtype}" "${PATCH_DIR}/patch-${origlog}-${fn}.txt" "${PATCH_DIR}/patch-${origlog}-${testtype}-${fn}.txt"
 
+    # shellcheck disable=SC2016
     numbranch=$(wc -l "${PATCH_DIR}/branch-${origlog}-${testtype}-${fn}.txt" | ${AWK} '{print $1}')
+    # shellcheck disable=SC2016
     numpatch=$(wc -l "${PATCH_DIR}/patch-${origlog}-${testtype}-${fn}.txt" | ${AWK} '{print $1}')
 
     calcdiffs \