From 6c7064167dcc3a365daac99632faaf35f42e2215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 19 Jan 2017 12:15:45 +0100 Subject: [PATCH] detect non UTF-8 characters --- Scripts/developer_scripts/test_merge_of_branch | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Scripts/developer_scripts/test_merge_of_branch b/Scripts/developer_scripts/test_merge_of_branch index 5039fb23e99..b6ef0b7d1f6 100755 --- a/Scripts/developer_scripts/test_merge_of_branch +++ b/Scripts/developer_scripts/test_merge_of_branch @@ -84,6 +84,7 @@ else fi #check cmake scripts of tests, examples are present +echo '.. Checking if all CMakeLists.txt are present...' for i in `ls -d ^build*/examples/*/ ^build*/test/*/`; do if ! [ -f $i/CMakeLists.txt ]; then echo "Error: $i/CMakeLists.txt does not exist!" @@ -93,6 +94,7 @@ done # check project in cmake scripts is correct +echo '.. Checking if all CMakeLists.txt project names are correct...' project_name_tests=$(for i in ^build*/test/*/CMakeLists.txt; do pkg=$(echo $i | awk -F "/" '{print $3}'); egrep "${pkg}_Tests\s*\)" -L $i; done) project_name_examples=$(for i in ^build*/examples/*/CMakeLists.txt; do pkg=$(echo $i | awk -F "/" '{print $3}'); egrep "${pkg}_Examples\s*\)" -L $i; done) project_name_demo=$(for i in ^build*/demo/*/CMakeLists.txt; do pkg=$(echo $i | awk -F "/" '{print $3}'); egrep "${pkg}_Demo\s*\)" -L $i; done) @@ -115,6 +117,15 @@ if [ -n "${project_name_demo}" ]; then exit 1 fi +#check no file contains non-utf8 characters +echo '.. Checking if non utf-8 characters are used...' +txt_not_utf8=$(for i in `find . -type f`; do out=`file $i`; if echo $out | grep -q "text"; then if ! (echo $out | egrep -q "UTF-8|ASCII|XML|EPS"); then echo $i; fi; fi; done) +if [ -n "${txt_not_utf8}" ]; then + echo "The following files have non utf-8 characters:" + echo ${txt_not_utf8} + exit 1 +fi + current_rev=$(${git} rev-parse HEAD) trap 'echo "(aborting the merge now)" && ${git} reset --quiet --hard ${current_rev}' EXIT