Merge pull request #14408 from ethereum/check-style-for-using-namespace-std-v2

Check style coverage for using namespace std
This commit is contained in:
Nikola Matić 2023-07-12 11:21:37 +02:00 committed by GitHub
commit 8390a24e30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,10 @@ EXCLUDE_FILES=(
EXCLUDE_FILES_JOINED=$(printf "%s\|" "${EXCLUDE_FILES[@]}")
EXCLUDE_FILES_JOINED=${EXCLUDE_FILES_JOINED%??}
NAMESPACE_STD_FREE_FILES=(
libevmasm/*
)
(
REPO_ROOT="$(dirname "$0")"/..
cd "$REPO_ROOT" || exit 1
@ -58,6 +62,9 @@ FORMATERROR=$(
# unqualified move()/forward() checks, i.e. make sure that std::move() and std::forward() are used instead of move() and forward()
preparedGrep "move\(.+\)" | grep -v "std::move" | grep -E "[^a-z]move"
preparedGrep "forward\(.+\)" | grep -v "std::forward" | grep -E "[^a-z]forward"
# make sure `using namespace std` is not used in INCLUDE_DIRECTORIES
# shellcheck disable=SC2068,SC2068
grep -nIE -d skip "using namespace std;" ${NAMESPACE_STD_FREE_FILES[@]}
) | grep -E -v -e "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" -e "^test/" || true
)