From c0b40b37e087eb4a66b959cd1a133eaad978c68d Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Mon, 26 Mar 2018 09:12:29 +0200 Subject: [PATCH] Silence bashate The remaining bashate warnings was E042: The return value of "local" is always 0; errors in subshells used for declaration are thus hidden and will not trigger "set -e". Fix the few cases this triggered so that we don't get confused anymore about the message. Remove -v from bashate invocation, we don't need to print out all the filenames anymore. Change-Id: I47991a7040c8b9183bc72cce8e5d95b2cec7e6c5 --- roles/copy-proposal-common-scripts/files/common.sh | 4 +++- roles/prep-zanata/files/common_translation_update.sh | 6 ++++-- .../prep-zanata/files/propose_translation_update.sh | 12 +++++++++--- tools/check_valid_gerrit_config.sh | 3 ++- tools/run-bashate.sh | 2 +- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/roles/copy-proposal-common-scripts/files/common.sh b/roles/copy-proposal-common-scripts/files/common.sh index c61759bc04..176e66b607 100644 --- a/roles/copy-proposal-common-scripts/files/common.sh +++ b/roles/copy-proposal-common-scripts/files/common.sh @@ -37,7 +37,9 @@ function setup_commit_message { CHANGE_NUM="" # See if there is an open change, if so, get the change id for the # existing change for use in the commit message. - local change_info=$(ssh -p 29418 $USERNAME@review.openstack.org \ + local change_info + + change_info=$(ssh -p 29418 $USERNAME@review.openstack.org \ gerrit query --current-patch-set status:open project:$PROJECT \ owner:$USERNAME branch:$BRANCH topic:$TOPIC) CHANGE_NUM=$(echo "$change_info" | grep "^ number:" | awk '{print $2}') diff --git a/roles/prep-zanata/files/common_translation_update.sh b/roles/prep-zanata/files/common_translation_update.sh index 2607b9309a..ec24c29c71 100644 --- a/roles/prep-zanata/files/common_translation_update.sh +++ b/roles/prep-zanata/files/common_translation_update.sh @@ -632,7 +632,8 @@ function cleanup_log_files { for i in $(find $modulename -name *.po) ; do # We do not store the log level files anymore, remove them # from git. - local bi=$(basename $i) + local bi + bi=$(basename $i) for level in $levels ; do if [[ "$bi" == "$modulename-log-$level.po" ]] ; then @@ -724,7 +725,8 @@ function copy_pot { for m in $all_modules ; do for f in `find $m -name "*.pot" ` ; do - local fd=$(dirname $f) + local fd + fd=$(dirname $f) mkdir -p $target/$fd cp $f $target/$f done diff --git a/roles/prep-zanata/files/propose_translation_update.sh b/roles/prep-zanata/files/propose_translation_update.sh index 80b88e39d4..34cbadc45c 100755 --- a/roles/prep-zanata/files/propose_translation_update.sh +++ b/roles/prep-zanata/files/propose_translation_update.sh @@ -42,7 +42,9 @@ function cleanup_module { function git_add_po_files { local target_dir=$1 - local po_file_count=`find $1 -name *.po | wc -l` + local po_file_count + + po_file_count=`find $1 -name *.po | wc -l` if [ $po_file_count -ne 0 ]; then git add $target_dir/*/* @@ -53,7 +55,9 @@ function git_add_po_files { function git_add_json_files { local target_dir=$1 - local json_file_count=`find $1 -name '*.json' | wc -l` + local json_file_count + + json_file_count=`find $1 -name '*.json' | wc -l` if [ $json_file_count -ne 0 ]; then git add $target_dir/* @@ -127,7 +131,9 @@ function propose_python_django { local version=$2 # Check for empty directory and exit early - local content=$(ls -A $modulename/locale/) + local content + + content=$(ls -A $modulename/locale/) if [[ "$content" == "" ]] ; then return diff --git a/tools/check_valid_gerrit_config.sh b/tools/check_valid_gerrit_config.sh index 3d7fdb6470..725481a90a 100755 --- a/tools/check_valid_gerrit_config.sh +++ b/tools/check_valid_gerrit_config.sh @@ -10,9 +10,10 @@ CONFIGS_LIST_BASE=$OLDPWD/$1 function check_team_acl { local configs_dir="$1" - local configs_list=$(find $configs_dir -name "*.config") + local configs_list local failure=0 + configs_list=$(find $configs_dir -name "*.config") for config in $configs_list; do $OLDPWD/tools/normalize_acl.py $config all > $TMPDIR/normalized diff --git a/tools/run-bashate.sh b/tools/run-bashate.sh index 56b7e407af..88fc2fa34a 100755 --- a/tools/run-bashate.sh +++ b/tools/run-bashate.sh @@ -7,4 +7,4 @@ ROOT=$(readlink -fn $(dirname $0)/.. ) find $ROOT -not -path '*playbooks/legacy/*' -and -not -wholename \*.tox/\* \ -and -not -wholename \*.test/\* \ - -and -name \*.sh -print0 | xargs -0 bashate -v --ignore E006,E011 + -and -name \*.sh -print0 | xargs -0 bashate --ignore E006,E011