Add tools for auto checking : pre-commit, tizen-sample-app-verifier.deb 08/63508/4
authorgs86.lee <gs86.lee@samsung.com>
Thu, 24 Mar 2016 08:54:35 +0000 (17:54 +0900)
committergs86.lee <gs86.lee@samsung.com>
Thu, 24 Mar 2016 10:03:38 +0000 (19:03 +0900)
Change-Id: I8d78be448baa1574dff4165c857c6743d95a0a07

tool/autoChecker/Git_Commit_Hook을_통한_자동_Verification_Tool_사용_가이드.docx [new file with mode: 0644]
tool/autoChecker/Guide_for_Auto_Verification_Tool_using_Git_Commit_Hook.docx [new file with mode: 0644]
tool/autoChecker/pre-commit [new file with mode: 0755]
tool/autoChecker/tizen-sample-app-verifier.deb [new file with mode: 0755]

diff --git a/tool/autoChecker/Git_Commit_Hook을_통한_자동_Verification_Tool_사용_가이드.docx b/tool/autoChecker/Git_Commit_Hook을_통한_자동_Verification_Tool_사용_가이드.docx
new file mode 100644 (file)
index 0000000..4d5ba43
Binary files /dev/null and "b/tool/autoChecker/Git_Commit_Hook\354\235\204_\355\206\265\355\225\234_\354\236\220\353\217\231_Verification_Tool_\354\202\254\354\232\251_\352\260\200\354\235\264\353\223\234.docx" differ
diff --git a/tool/autoChecker/Guide_for_Auto_Verification_Tool_using_Git_Commit_Hook.docx b/tool/autoChecker/Guide_for_Auto_Verification_Tool_using_Git_Commit_Hook.docx
new file mode 100644 (file)
index 0000000..0bf9eb1
Binary files /dev/null and b/tool/autoChecker/Guide_for_Auto_Verification_Tool_using_Git_Commit_Hook.docx differ
diff --git a/tool/autoChecker/pre-commit b/tool/autoChecker/pre-commit
new file mode 100755 (executable)
index 0000000..7611452
--- /dev/null
@@ -0,0 +1,127 @@
+#!/bin/bash
+
+####################### Check Command #######################
+if ! type "tcc.py" > /dev/null 2>&1; then
+       echo -e "Error!";
+       echo -e "The command(tcc.py) is not found!
+       Please install the tcc.py and set up on the PATH
+       e.g - export PATH=\$PATH:\${TCC_PATH} or
+       cp tcc.py /usr/local/bin"
+       exit 1;
+fi
+
+if ! type "checkpatchinit_tizen.sh" > /dev/null 2>&1; then
+       echo -e "Error!";
+       echo -e "The command(checkpatchinit_tizen.sh) is not found!
+       Please install the checkpatchinit_tizen.sh and set up on the PATH
+       e.g - export PATH=\$PATH:\${CHECK_PATCH_INIT_TIZEN_PATH} or
+       cp checkpatchinit_tizen.sh /usr/local/bin
+       cp checkpatch_tizen.pl /usr/local/bin";
+       exit 1;
+fi
+
+if ! type "aspell" > /dev/null 2>&1; then
+       echo -e "Error!";
+       echo -e "The command(aspell) is not found!
+       Please install the aspell
+       e.g - sudo apt-get install aspell aspell-en";
+       exit 1;
+fi
+
+
+root_dir=`git rev-parse --show-toplevel`
+
+
+####################### Check tcc.py #######################
+template_dir=$TEMPLATE_DIR
+
+if [ ! -d "${template_dir}" ]
+then
+       echo -e "Error!";
+       echo -e "The template path is not directory! [${template_dir}]
+       Please set up the template path on the '\$TEMPLATE_DIR'";
+       exit 1;
+fi
+
+echo -e "Compared directory with
+[${template_dir}:${root_dir}]";
+
+echo -e ">>>>>>>>>>>>>>>>>>>> Run tcc.py";
+
+tcc_msg=$(tcc.py ${template_dir} ${root_dir});
+if [ $? -ne 0 ]
+then
+       echo -e "Error!";
+       echo -e "The compared directory is not correct!";
+       echo -e "${tcc_msg}";
+       exit 1;
+fi
+echo -e ">>>>>>>>>>>>>>>>>>>> Done";
+echo -e "";
+
+####################### Check checkpatchinit_tizen.sh #######################
+echo -e ">>>>>>>>>>>>>>>>>>>> Run checkpatchinit_tizen.sh";
+error_count=$(checkpatchinit_tizen.sh ${root_dir} | grep "ERROR" -c);
+if [ "$error_count" -ne 0 ]
+then
+       echo -e "Error!
+       The below codes wasn't observed for a Tizen Coding Rule!
+       Please review again!";
+       checkpatchinit_tizen.sh ${root_dir} | grep "ERROR" --color=auto;
+       exit 1;
+fi
+echo -e ">>>>>>>>>>>>>>>>>>>> Done";
+echo -e "";
+
+####################### Check spell #######################
+
+find . -type f \( ! -path '*.git*' \
+       ! -path '*.sign*' \
+       ! -path '*Debug*' \
+       ! -path '*Release*' \
+       ! -name '*dic.dat' \
+       ! -name '.*' \
+       ! -name '*.png' \
+       ! -name '*.jpg' \
+       ! -name '*files.tmp' \) > .files.tmp
+
+echo -e ">>>>>>>>>>>>>>>>>>>> Run spell";
+while read file; do
+
+       mode="none"
+
+       [[ $file == *.xml ]]    && mode="sgml"
+       [[ $file == *.h ]]              && mode="ccpp"
+       [[ $file == *.c ]]              && mode="ccpp"
+       [[ $file == *.cpp ]]    && mode="ccpp"
+       [[ $file == *.js ]]             && mode="ccpp"
+       [[ $file == *.html ]]   && mode="html"
+
+       if [[ $mode == none ]]
+       then
+               result_aspell="$(aspell list <$file)"
+       else
+               result_aspell="$(aspell list --mode=$mode <$file)"
+       fi
+
+       result_aspell_count="$(echo $result_aspell | wc -w)"
+
+       echo "Proceess ${file} - [${result_aspell_count}]";
+       if [ $result_aspell_count -ne 0 ]
+       then
+               echo -e "Error!"
+               echo -e "Misspelled words detected!";
+               for word in $result_aspell
+               do
+                       echo -e "$file : $word"
+               done
+               exit 1;
+       fi
+
+done < .files.tmp
+
+rm .files.tmp
+
+echo -e ">>>>>>>>>>>>>>>>>>>> Done";
+echo -e "";
+exit 0;
diff --git a/tool/autoChecker/tizen-sample-app-verifier.deb b/tool/autoChecker/tizen-sample-app-verifier.deb
new file mode 100755 (executable)
index 0000000..5c87e99
Binary files /dev/null and b/tool/autoChecker/tizen-sample-app-verifier.deb differ