From 67bd764a29f0b365ccbd5e26b2b586cbb10c6326 Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 16 Aug 2017 12:57:24 +0100 Subject: [PATCH] added detected of trailing whitespace bar lines --- whitespace.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/whitespace.sh b/whitespace.sh index 510b2548..4320b058 100755 --- a/whitespace.sh +++ b/whitespace.sh @@ -27,10 +27,12 @@ start_time="$(start_timer)" whitespace_only_files_found=0 trailing_whitespace_files_found=0 +trailing_whitespace_bar_files_found=0 for filename in $(find "${1:-.}" -type f | egrep -vf "$srcdir/whitespace_ignore.txt"); do isExcluded "$filename" && continue grep -Hn '^[[:space:]]\+$' "$filename" && let whitespace_only_files_found+=1 || : grep -Hn '[[:space:]]\+$' "$filename" && let trailing_whitespace_files_found+=1 || : + egrep -Hn '[[:space:]]{4}\|[[:space:]]*$' "$filename" && let trailing_whitespace_bar_files_found+=1 || : done if [ $whitespace_only_files_found -gt 0 ]; then echo "$whitespace_only_files_found files with whitespace only lines detected!" @@ -38,7 +40,10 @@ fi if [ $trailing_whitespace_files_found -gt 0 ]; then echo "$trailing_whitespace_files_found files with trailing whitespace lines detected!" fi -if [ $whitespace_only_files_found -gt 0 -o $trailing_whitespace_files_found -gt 0 ]; then +if [ $trailing_whitespace_bar_files_found -gt 0 ]; then + echo "$trailing_whitespace_bar_files_found files with trailing whitespace bar lines detected!" +fi +if [ $whitespace_only_files_found -gt 0 -o $trailing_whitespace_files_found -gt 0 -o $trailing_whitespace_bar_files_found -gt 0 ]; then return 1 &>/dev/null || : exit 1 fi