aboutsummaryrefslogtreecommitdiff
path: root/test/lint
diff options
context:
space:
mode:
authorBen Woosley <ben.woosley@gmail.com>2018-05-21 20:20:24 -0700
committerBen Woosley <ben.woosley@gmail.com>2018-06-06 02:11:25 -0700
commit9d6c9dbb88593dea995072ba812f115a51ea2b4b (patch)
tree156f22bdc7275c0875b1895ed60905ec6bd185d6 /test/lint
parenta589f536b5e15daf3ac6ffcc137a146514c81967 (diff)
lint: Add linter to error on #include <*.cpp>
Files should depend on one another by interface, not by implementation. This checks for quoted includes as well. With practicalswift
Diffstat (limited to 'test/lint')
-rwxr-xr-xtest/lint/lint-includes.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/lint/lint-includes.sh b/test/lint/lint-includes.sh
index 7cab0ca4d1..2c3456b644 100755
--- a/test/lint/lint-includes.sh
+++ b/test/lint/lint-includes.sh
@@ -33,6 +33,14 @@ for CPP_FILE in $(filter_suffix cpp); do
fi
done
+INCLUDED_CPP_FILES=$(git grep -E "^#include [<\"][^>\"]+\.cpp[>\"]" -- "*.cpp" "*.h")
+if [[ ${INCLUDED_CPP_FILES} != "" ]]; then
+ echo "The following files #include .cpp files:"
+ echo "${INCLUDED_CPP_FILES}"
+ echo
+ EXIT_CODE=1
+fi
+
EXPECTED_BOOST_INCLUDES=(
boost/algorithm/string.hpp
boost/algorithm/string/case_conv.hpp