From 766967913c809d39e79fcc12d27b904c4f2008ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 1 May 2019 17:05:13 +0200 Subject: [PATCH] add checks for the presence of tabs and trailing whitespaces --- Scripts/developer_scripts/test_merge_of_branch | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Scripts/developer_scripts/test_merge_of_branch b/Scripts/developer_scripts/test_merge_of_branch index fca78d160d2..0bdd0c85b10 100755 --- a/Scripts/developer_scripts/test_merge_of_branch +++ b/Scripts/developer_scripts/test_merge_of_branch @@ -162,6 +162,24 @@ if [ -n "${txt_not_utf8}" ]; then exit 1 fi +#check no file contains tab characters +echo '.. Checking if tab character is used...' +file_with_tabs=$(git ls-files --stage | egrep '\.txt|\.h$|\.cpp|\.hpp' | awk '{print $4}' | xargs grep -P -l '\t') +if [ -n "${file_with_tabs}" ]; then + echo "The following files have tabs:" + echo ${file_with_tabs} + exit 1 +fi + +#check no file contains trailing whitespaces characters +echo '.. Look for trailing whitespaces...' +files_with_trailingws=$(git ls-files --stage | egrep '\.txt|\.h$|\.cpp|\.hpp' | awk '{print $4}' | xargs grep -P -l '\s+$') +if [ -n "${files_with_trailingws}" ]; then + echo "The following files have trailing whitespaces:" + echo ${files_with_trailingws} + exit 1 +fi + #check all headers in documentation actually exist echo '.. Checking if all documentation headers exist' not_existing_headers=$(bash ./Scripts/developer_scripts/check_headers.sh $PWD)