aboutsummaryrefslogtreecommitdiff
path: root/test/lint
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2018-05-14 09:51:29 +0200
committerpracticalswift <practicalswift@users.noreply.github.com>2018-06-06 11:09:05 +0200
commit6d10f43738d58bf623975e3124fd5735aac7d3e1 (patch)
treee328e9f89e2375719827355a04b9a38d752876c6 /test/lint
parent906bee8e5f474f8718d02e6f1938f20dcfe3d2cc (diff)
downloadbitcoin-6d10f43738d58bf623975e3124fd5735aac7d3e1.tar.xz
Enforce the use of bracket syntax includes ("#include <foo.h>")
Diffstat (limited to 'test/lint')
-rwxr-xr-xtest/lint/lint-includes.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/lint/lint-includes.sh b/test/lint/lint-includes.sh
index 7cab0ca4d1..b0ba5f63af 100755
--- a/test/lint/lint-includes.sh
+++ b/test/lint/lint-includes.sh
@@ -6,9 +6,12 @@
#
# Check for duplicate includes.
# Guard against accidental introduction of new Boost dependencies.
+# Check includes: Check for duplicate includes. Enforce bracket syntax includes.
+
+IGNORE_REGEXP="/(leveldb|secp256k1|univalue)/"
filter_suffix() {
- git ls-files | grep -E "^src/.*\.${1}"'$' | grep -Ev "/(leveldb|secp256k1|univalue)/"
+ git ls-files | grep -E "^src/.*\.${1}"'$' | grep -Ev "${IGNORE_REGEXP}"
}
EXIT_CODE=0
@@ -97,4 +100,12 @@ for EXPECTED_BOOST_INCLUDE in "${EXPECTED_BOOST_INCLUDES[@]}"; do
fi
done
+QUOTE_SYNTAX_INCLUDES=$(git grep '^#include "' -- "*.cpp" "*.h" | grep -Ev "${IGNORE_REGEXP}")
+if [[ ${QUOTE_SYNTAX_INCLUDES} != "" ]]; then
+ echo "Please use bracket syntax includes (\"#include <foo.h>\") instead of quote syntax includes:"
+ echo "${QUOTE_SYNTAX_INCLUDES}"
+ echo
+ EXIT_CODE=1
+fi
+
exit ${EXIT_CODE}