File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ if git rev-parse --verify HEAD > /dev/null 2>&1
4+ then
5+ against=HEAD
6+ else
7+ # Initial commit: diff against an empty tree object
8+ against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
9+ fi
10+
11+ FILES=$( git diff-index --name-only --diff-filter=ACMR --cached $against -- | egrep " .py$" )
12+ if [ " $FILES " != " " ]; then
13+ # We want to look at the staged version only, so we have to run it once for
14+ # each file.
15+ E=0
16+ for F in ${FILES} ; do
17+ P=$( git show " :$F " | python3 -c " import sys; compile(sys.stdin.read(), '/dev/null', 'exec')" )
18+ if [ " $? " != " 0" ]; then
19+ echo " Errors in $F "
20+ echo $P
21+ E=1
22+ continue
23+ fi
24+
25+ R=$( git show " :$F " | pep8 -)
26+ if [ " $? " != " 0" ]; then
27+ echo " Errors in $F "
28+ echo " $R "
29+ E=1
30+ fi
31+ done
32+ if [ " $E " != " 0" ]; then
33+ exit 1
34+ fi
35+
36+ echo Basic python checks passed.
37+ fi
38+
You can’t perform that action at this time.
0 commit comments