chiark / gitweb /
pre-commit: pep8 is now pycodestyle
authorDaniel Martí <mvdan@mvdan.cc>
Wed, 13 Jul 2016 11:14:19 +0000 (12:14 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Wed, 13 Jul 2016 13:42:23 +0000 (14:42 +0100)
See https://github.com/PyCQA/pycodestyle/issues/466.

hooks/pre-commit

index 662e5787f1f8ccf913915609dee4a69133654359..45a5b05234da3ecd3b4e5dea4f8b8cb0dcf0ebe5 100755 (executable)
@@ -72,20 +72,21 @@ cmd_exists() {
 }
 
 find_command() {
-       local name=$1
-       for suff in "3" "-python3" ""; do
-               cmd=${1}${suff}
-               if cmd_exists $cmd; then
-                       echo $cmd
-                       return 0
-               fi
+       for name in $@; do
+               for suff in "3" "-python3" ""; do
+                       cmd=${name}${suff}
+                       if cmd_exists $cmd; then
+                               echo $cmd
+                               return 0
+                       fi
+               done
        done
        warn "$1 is not installed, using dummy placeholder!"
-       echo -n :
+       echo :
 }
 
 PYFLAKES=$(find_command pyflakes)
-PEP8=$(find_command pep8)
+PEP8=$(find_command pycodestyle pep8)
 
 if [ "$PY_FILES $PY_TEST_FILES" != " " ]; then
     if ! $PYFLAKES $PY_FILES $PY_TEST_FILES; then