Skip to content

Commit 6d10f43

Browse files
Enforce the use of bracket syntax includes ("#include <foo.h>")
1 parent 906bee8 commit 6d10f43

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/lint/lint-includes.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
#
77
# Check for duplicate includes.
88
# Guard against accidental introduction of new Boost dependencies.
9+
# Check includes: Check for duplicate includes. Enforce bracket syntax includes.
10+
11+
IGNORE_REGEXP="/(leveldb|secp256k1|univalue)/"
912

1013
filter_suffix() {
11-
git ls-files | grep -E "^src/.*\.${1}"'$' | grep -Ev "/(leveldb|secp256k1|univalue)/"
14+
git ls-files | grep -E "^src/.*\.${1}"'$' | grep -Ev "${IGNORE_REGEXP}"
1215
}
1316

1417
EXIT_CODE=0
@@ -97,4 +100,12 @@ for EXPECTED_BOOST_INCLUDE in "${EXPECTED_BOOST_INCLUDES[@]}"; do
97100
fi
98101
done
99102

103+
QUOTE_SYNTAX_INCLUDES=$(git grep '^#include "' -- "*.cpp" "*.h" | grep -Ev "${IGNORE_REGEXP}")
104+
if [[ ${QUOTE_SYNTAX_INCLUDES} != "" ]]; then
105+
echo "Please use bracket syntax includes (\"#include <foo.h>\") instead of quote syntax includes:"
106+
echo "${QUOTE_SYNTAX_INCLUDES}"
107+
echo
108+
EXIT_CODE=1
109+
fi
110+
100111
exit ${EXIT_CODE}

0 commit comments

Comments
 (0)