代码拉取完成,页面将自动刷新
同步操作将从 jiujiangxueyuan/DevOps-Bash-tools 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/usr/bin/env bash
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: 2017-10-08 16:57:51 +0100 (Sun, 08 Oct 2017)
#
# https://github.com/harisekhon/bash-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/harisekhon
#
set -euo pipefail
[ -n "${DEBUG:-}" ] && set -x
srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=lib/utils.sh
. "$srcdir/lib/utils.sh"
section "Checking all test_*.sh run calls are fully qualified"
failed_count=0
scripts="$(find "${1:-.}" -maxdepth 2 -type f -name 'test*.sh')"
#while read script; do
# doesn't handle whitespace in names but makes global variable access easier we don't use whitespace in names in unix
for script in $scripts; do
# this fails files broken on whitespace immediately, will count as 2 of more separate files not found
echo -n "checking script $script => "
if ! [ -f "$script" ]; then
((failed_count + 1))
echo "NOT FOUND"
continue
fi
set +eo pipefail
# don't anchor grep -v as we're prefixing line numbers for convenience
# run
# run_fail \d+
# run_fail "\d+ \d+ ..."
# run_conn_refused
# run_usage
# run_404
# run_timeout
run_fail='run(_[a-z]+[[:digit:]]* "?[[:digit:][:space:]]+"?|_conn_refused|_usage|_404|_timeout)?'
# docker-compose or docker exec or docker run
docker_regex='docker(-compose|[[:space:]]+(exec|run))'
suspect_lines="$(grep -En '^[[:space:]]*run(_.+)?[[:space:]]+' "$script" |
grep -Ev -e "[[:space:]]*${run_fail}[[:space:]](.*[[:space:]])?(./|(\\\$perl|eval|$docker_regex)[[:space:]])" \
-e '[[:space:]]*run_test_versions' \
-e '[[:space:]]*run_(grep|output)[[:space:]].+(\$|./)' \
-e 'ignore_run_unqualified' \
# run_grep filter is not that accurate but will do for now
)"
set -eo pipefail
if [ -n "$suspect_lines" ]; then
((failed_count + 1))
echo "Suspect lines detected!"
echo
echo "$suspect_lines"
echo
else
echo "OK"
fi
done
if [ "$failed_count" = 0 ]; then
echo
echo 'Passed checks'
echo
else
echo
echo "$failed_count scripts with non-qualified command run arguments detected!"
exit 1
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。