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