Check style coverage for using namespace std

This commit is contained in:
Nikola Matic 2023-07-11 20:28:21 +02:00
parent b583e9e64d
commit c1ca2bf9d2

View File

@ -20,6 +20,10 @@ EXCLUDE_FILES=(
EXCLUDE_FILES_JOINED=$(printf "%s\|" "${EXCLUDE_FILES[@]}") EXCLUDE_FILES_JOINED=$(printf "%s\|" "${EXCLUDE_FILES[@]}")
EXCLUDE_FILES_JOINED=${EXCLUDE_FILES_JOINED%??} EXCLUDE_FILES_JOINED=${EXCLUDE_FILES_JOINED%??}
NAMESPACE_STD_FREE_FILES=(
libevmasm/*
)
( (
REPO_ROOT="$(dirname "$0")"/.. REPO_ROOT="$(dirname "$0")"/..
cd "$REPO_ROOT" || exit 1 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() # 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 "move\(.+\)" | grep -v "std::move" | grep -E "[^a-z]move"
preparedGrep "forward\(.+\)" | grep -v "std::forward" | grep -E "[^a-z]forward" 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 ) | grep -E -v -e "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" -e "^test/" || true
) )