Skip to content

Commit e4082d5

Browse files
author
MarcoFalke
committed
Merge #13301: lint: Add linter to error on #include <*.cpp>
9d6c9db lint: Add linter to error on #include <*.cpp> (Ben Woosley) Pull request description: Files should depend on one another by interface, not by implementation. This checks for quoted includes as well. Tree-SHA512: d36d468f48d538077f5f927b9561729fd7d76319f6b2e2cc10414a9f243588194e90ca1d85eca65019f9259268f555d25106eaaa56da28c58fa8d5837b469661
2 parents a589f53 + 9d6c9db commit e4082d5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/lint/lint-includes.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ for CPP_FILE in $(filter_suffix cpp); do
3333
fi
3434
done
3535

36+
INCLUDED_CPP_FILES=$(git grep -E "^#include [<\"][^>\"]+\.cpp[>\"]" -- "*.cpp" "*.h")
37+
if [[ ${INCLUDED_CPP_FILES} != "" ]]; then
38+
echo "The following files #include .cpp files:"
39+
echo "${INCLUDED_CPP_FILES}"
40+
echo
41+
EXIT_CODE=1
42+
fi
43+
3644
EXPECTED_BOOST_INCLUDES=(
3745
boost/algorithm/string.hpp
3846
boost/algorithm/string/case_conv.hpp

0 commit comments

Comments
 (0)