Initial coala delint (scripts) 73/3873/1
authorAndrew Grimberg <agrimberg@linuxfoundation.org>
Wed, 3 May 2017 20:17:08 +0000 (16:17 -0400)
committerAndrew Grimberg <agrimberg@linuxfoundation.org>
Wed, 3 May 2017 20:17:08 +0000 (16:17 -0400)
Initial coala delint for global scripts

Issue: CIMAN-2
Change-Id: Ia1ef0585b8c929ce25aebaa0178b039e0ac6f93e
Signed-off-by: Andrew Grimberg <agrimberg@linuxfoundation.org>
scripts/check-unicode.sh

index db45f6a..931c99f 100755 (executable)
 #   Thanh Ha (The Linux Foundation) - Initial implementation
 ##############################################################################
 
-directory="."
-if [ ! -z "$1" ]; then
-    directory="$1"
-fi
+directory=${1:-"."}
 
 echo "Scanning $directory"
-for x in $(find $directory -type f); do
-    if LC_ALL=C grep -q '[^[:print:][:space:]]' "$x"; then
-        echo "file "$x" contains non-ascii characters"
-        exit 1
-    fi
-done
+if LC_ALL=C grep -r '[^[:print:][:space:]]' "$directory"; then
+    echo "Found files containing non-ascii characters."
+    exit 1
+fi
 
 echo "All files are ASCII only"
+