forked from collective/tutorial.todoapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre-commit-check.sh
More file actions
executable file
·30 lines (23 loc) · 893 Bytes
/
Copy pathpre-commit-check.sh
File metadata and controls
executable file
·30 lines (23 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# to install: $ ln -s ../../pre-commit-check.sh .git/hooks/pre-commit
# TODO: stash changes before doing tests: http://codeinthehole.com/writing/tips-for-using-a-git-pre-commit-hook/
function handle_exit {
if [ $? -ne 0 ]; then
EXITCODE=1
fi
}
EXITCODE=0
echo 'Running tests'
bin/test; handle_exit
echo '====== Running ZPTLint ======'
for pt in `find src/tutorial/todoapp/ -name "*.pt"` ; do bin/zptlint $pt; done
for xml in `find src/tutorial/todoapp/ -name "*.xml"` ; do bin/zptlint $xml; done
for zcml in `find src/tutorial/todoapp/ -name "*.zcml"` ; do bin/zptlint $zcml; done
echo '====== Running PyFlakes ======'
bin/zopepy setup.py flakes; handle_exit
echo '====== Running pep8 =========='
bin/pep8 --ignore=E501 --count src/tutorial/todoapp; handle_exit
bin/pep8 --ignore=E501 --count setup.py; handle_exit
if [ $EXITCODE -ne 0 ]; then
exit 1
fi