add checks for the presence of tabs and trailing whitespaces

This commit is contained in:
Sébastien Loriot 2019-05-01 17:05:13 +02:00
parent 8c011a0467
commit 766967913c
1 changed files with 18 additions and 0 deletions

View File

@ -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)