From d0e8ae3aa550e726c910cf7eff70bfff04fa2999 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Fri, 18 Dec 2020 18:47:13 -0500 Subject: [PATCH] scripts/check_style.sh: add exclude list support. --- scripts/check_style.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/check_style.sh b/scripts/check_style.sh index 7d73b8470..80b7b6591 100755 --- a/scripts/check_style.sh +++ b/scripts/check_style.sh @@ -2,13 +2,19 @@ . scripts/report_errors.sh +EXCLUDE_FILES=( + "libsolutil/picosha2.h" + "test/libsolutil/UTF8.cpp" +) +EXCLUDE_FILES_JOINED=$(printf "%s\|" "${EXCLUDE_FILES[@]}") +EXCLUDE_FILES_JOINED=${EXCLUDE_FILES_JOINED%??} + ( REPO_ROOT="$(dirname "$0")"/.. cd $REPO_ROOT WHITESPACE=$(git grep -n -I -E "^.*[[:space:]]+$" | - grep -v "test/libsolidity/ASTJSON\|test/libsolidity/ASTRecoveryTests\|test/compilationTests/zeppelin/LICENSE" | - grep -v -E "test/libsolidity/syntaxTests/comments/unicode_direction_override_1.sol" + grep -v "test/libsolidity/ASTJSON\|test/libsolidity/ASTRecoveryTests\|test/compilationTests/zeppelin/LICENSE\|${EXCLUDE_FILES_JOINED}" ) if [[ "$WHITESPACE" != "" ]] @@ -20,11 +26,10 @@ fi function preparedGrep() { - git grep -nIE "$1" -- '*.h' '*.cpp' | grep -v "picosha2.h" + git grep -nIE "$1" -- '*.h' '*.cpp' | grep -v "${EXCLUDE_FILES_JOINED}" return $? } - FORMATERROR=$( ( preparedGrep "#include \"" | egrep -v -e "license.h" -e "BuildInfo.h" # Use include with <> characters