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
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