Fix shellcheck errors in report_errors.sh and check_style.sh

This commit is contained in:
Kamil Śliwak 2021-01-15 21:12:19 +01:00
parent 877b5d1c1c
commit e5bc08fa7b
3 changed files with 8 additions and 10 deletions

View File

@ -14,7 +14,7 @@ EXCLUDE_FILES_JOINED=${EXCLUDE_FILES_JOINED%??}
(
REPO_ROOT="$(dirname "$0")"/..
cd "$REPO_ROOT"
cd "$REPO_ROOT" || exit 1
WHITESPACE=$(git grep -n -I -E "^.*[[:space:]]+$" |
grep -v "test/libsolidity/ASTJSON\|test/libsolidity/ASTRecoveryTests\|test/compilationTests/zeppelin/LICENSE\|${EXCLUDE_FILES_JOINED}"
@ -36,17 +36,17 @@ function preparedGrep()
FORMATERROR=$(
(
preparedGrep "#include \"" | egrep -v -e "license.h" -e "BuildInfo.h" # Use include with <> characters
preparedGrep "#include \"" | grep -E -v -e "license.h" -e "BuildInfo.h" # Use include with <> characters
preparedGrep "\<(if|for|while|switch)\(" # no space after "if", "for", "while" or "switch"
preparedGrep "\<for\>\s*\([^=]*\>\s:\s.*\)" # no space before range based for-loop
preparedGrep "\<if\>\s*\(.*\)\s*\{\s*$" # "{\n" on same line as "if" / "for"
preparedGrep "[,\(<]\s*const " # const on left side of type
preparedGrep "^\s*(static)?\s*const " # const on left side of type (beginning of line)
preparedGrep "^ [^*]|[^*] | [^*]" # uses spaces for indentation or mixes spaces and tabs
preparedGrep "[a-zA-Z0-9_]\s*[&][a-zA-Z_]" | egrep -v "return [&]" # right-aligned reference ampersand (needs to exclude return)
preparedGrep "[a-zA-Z0-9_]\s*[&][a-zA-Z_]" | grep -E -v "return [&]" # right-aligned reference ampersand (needs to exclude return)
# right-aligned reference pointer star (needs to exclude return and comments)
preparedGrep "[a-zA-Z0-9_]\s*[*][a-zA-Z_]" | egrep -v -e "return [*]" -e "^* [*]" -e "^*//.*"
) | egrep -v -e "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" -e "^test/"
preparedGrep "[a-zA-Z0-9_]\s*[*][a-zA-Z_]" | grep -E -v -e "return [*]" -e "^* [*]" -e "^*//.*"
) | grep -E -v -e "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" -e "^test/"
)
if [[ "$FORMATERROR" != "" ]]

View File

@ -14,7 +14,6 @@
./scripts/docker_build.sh
./scripts/docs_version_pragma_check.sh
./scripts/uniqueErrors.sh
./scripts/report_errors.sh
./scripts/tests.sh
./scripts/docker_deploy.sh
./scripts/bytecodecompare/storebytecode.sh
@ -24,7 +23,6 @@
./scripts/install_obsolete_jsoncpp_1_7_4.sh
./scripts/install_deps.sh
./scripts/build.sh
./scripts/check_style.sh
./scripts/run_proofs.sh
./scripts/common_cmdline.sh
./scripts/docker_deploy_manual.sh

View File

@ -4,7 +4,7 @@ ERROR_LOG="$1"
function report_error_to_github
{
if [ -z "$CIRCLE_PR_NUMBER" ]
if [[ $CIRCLE_PR_NUMBER != "" ]]
then
CIRCLE_PR_NUMBER="${CIRCLE_PULL_REQUEST//[^0-9]/}"
fi
@ -13,7 +13,7 @@ function report_error_to_github
echo "$ERROR_MSG"
if [ ! -z "$CI" ]
if [[ $CI == "true" ]]
then
echo "posting error message to github"
post_error_to_github
@ -43,7 +43,7 @@ function post_review_comment_to_github
sed -i 1d "$ERROR_LOG"
while read line
while read -r line
do
ERROR_PATH=$(echo "$line" | grep -oE ".*\.cpp")
ERROR_LINE=$(echo "$line" | grep -oE "[0-9]*")