Merge pull request #10663 from ethereum/check_style_exclude_list_support

scripts/check_style.sh: add exclude list support.
This commit is contained in:
Leonardo 2021-01-12 11:28:26 +01:00 committed by GitHub
commit 7824ccb56d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,13 +2,19 @@
. scripts/report_errors.sh . 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")"/.. REPO_ROOT="$(dirname "$0")"/..
cd $REPO_ROOT cd $REPO_ROOT
WHITESPACE=$(git grep -n -I -E "^.*[[:space:]]+$" | WHITESPACE=$(git grep -n -I -E "^.*[[:space:]]+$" |
grep -v "test/libsolidity/ASTJSON\|test/libsolidity/ASTRecoveryTests\|test/compilationTests/zeppelin/LICENSE" | grep -v "test/libsolidity/ASTJSON\|test/libsolidity/ASTRecoveryTests\|test/compilationTests/zeppelin/LICENSE\|${EXCLUDE_FILES_JOINED}"
grep -v -E "test/libsolidity/syntaxTests/comments/unicode_direction_override_1.sol"
) )
if [[ "$WHITESPACE" != "" ]] if [[ "$WHITESPACE" != "" ]]
@ -20,11 +26,10 @@ fi
function preparedGrep() function preparedGrep()
{ {
git grep -nIE "$1" -- '*.h' '*.cpp' | grep -v "picosha2.h" git grep -nIE "$1" -- '*.h' '*.cpp' | grep -v "${EXCLUDE_FILES_JOINED}"
return $? return $?
} }
FORMATERROR=$( FORMATERROR=$(
( (
preparedGrep "#include \"" | egrep -v -e "license.h" -e "BuildInfo.h" # Use include with <> characters preparedGrep "#include \"" | egrep -v -e "license.h" -e "BuildInfo.h" # Use include with <> characters