scripts/check_style.sh: add exclude list support.

This commit is contained in:
Alexander Arlt 2020-12-18 18:47:13 -05:00
parent 158154bac3
commit d0e8ae3aa5

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