PageRenderTime 24ms CodeModel.GetById 16ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/dist/check-code.sh

http://txt2tags.googlecode.com/
Shell | 43 lines | 26 code | 12 blank | 5 comment | 8 complexity | fee9ecaaf5e10d3fbb07ecb298b3096e MD5 | raw file
 1#!/bin/bash
 2# check-code.sh - Checks txt2tags code
 3# by Aurelio Jargas
 4
 5t2t=../txt2tags
 6
 7hecho(){ echo -e "\033[36;1mCode: $*\033[m"; }
 8
 9cd $(dirname "$0")
10
11hecho 'checking shebang'
12[ "$(head -1 $t2t)" != "#!/usr/bin/env python" ] && echo FAIL
13
14hecho "checking if executable"
15ls -l $t2t | grep -qs '^-rwxr-xr-x' || echo FAIL
16
17hecho "checking year of Copyright"
18grep -qs "Copyright.*$(date +%Y)" $t2t || echo FAIL
19
20hecho "searching for !ASCII chars"
21grep -v '^[	-~]*$' $t2t  # [TAB-~]
22
23hecho "searching for useless blanks"
24egrep '[^ 	][ 	]+$' $t2t | sed -n l  # \S\s$
25egrep ' 	' $t2t | sed -n l             # space+TAB
26# grep '^ ' $t2t                                # leading space
27
28hecho "searching for lines >80 columns"
29# sed "s/$(echo -ne '\t')/        /g" $t2t | egrep '.{81}'
30echo DISABLED
31
32hecho "checking PEP-8 compliance"
33if pep8 --version >/dev/null 2>&1
34then
35    pep8 --ignore E203,E221,E241,E501 -r $t2t
36else
37    echo "pep8 command not installed"
38    echo "See http://pypi.python.org/pypi/pep8"
39fi
40        
41hecho 'checking version'
42$t2t -V | sed 's/<.*//'
43