diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2014-12-08 14:58:03 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2014-12-08 14:58:03 +0000 |
commit | 807527bc3b79a30c0c86ffc27143ee1d45a84a77 (patch) | |
tree | e4189eacbda7b50044a4c07833b8e46c472622eb /scripts/check_google_style.sh | |
parent | 74139b5adc369b0c7f0163e5ec04eb8685ff5f07 (diff) |
Add of tests tools
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cpplint_test@344 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Diffstat (limited to 'scripts/check_google_style.sh')
-rwxr-xr-x | scripts/check_google_style.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/check_google_style.sh b/scripts/check_google_style.sh new file mode 100755 index 00000000..fc659346 --- /dev/null +++ b/scripts/check_google_style.sh @@ -0,0 +1,32 @@ +#!/bin/bash +#usage bash check_google_style.sh + +# VERSION CHECK +ROOT_DIR=.. +FILE_TO_CHECK="$1" +LOG_FILE=$FILE_TO_CHECK.cpplint + +if [ -f $LOG_FILE ]; then + rm -f $LOG_FILE +fi + +if [ ! -f $FILE_TO_CHECK ]; then + echo "File not found! : $FILE_TO_CHECK" | tee -a $LOG_FILE + exit 1 +fi + +# CPPLINT FILE +echo "File: $FILE_TO_CHECK" 2>&1 | tee -a $LOG_FILE +python ~/cpplint.py --linelength=120 $FILE_TO_CHECK 2>&1 | tee -a $LOG_FILE + +LINE_ERRORS=`grep "Total errors found:" $LOG_FILE` +NB_ERRORS=${LINE_ERRORS:20} + +if [ "$NB_ERRORS" -gt 20 ] +then + echo "## Too many errors ($NB_ERRORS) in $FILE_TO_CHECK" 2>&1 | tee -a $LOG_FILE + exit 1 +fi + +echo "Acceptable number of errors ($NB_ERRORS) in $FILE_TO_CHECK" 2>&1 | tee -a $LOG_FILE +exit 0 |