Skip to content

Commit 9d6c9db

Browse files
committed
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
1 parent a589f53 commit 9d6c9db

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)