From: Daniel Martí Date: Wed, 13 Jul 2016 11:07:03 +0000 (+0100) Subject: pre-commit: fix warnings and errors X-Git-Tag: 0.7.0~32^2~1 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=fdroidserver.git;a=commitdiff_plain;h=d8a8c2458461fb0fc035d0c9a606cf76f7757057 pre-commit: fix warnings and errors Properly print warnings to stderr. Also, use : instead of 'echo' as a fallback as the latter spits out garbage to stdout. Examples without pep8 installed. Before: $ ./hooks/pre-commit ./hooks/pre-commit: line 97: WARNING:: command not found ERROR: pep8 tests failed! After: $ ./hooks/pre-commit WARNING: pep8 is not installed, using dummy placeholder! --- diff --git a/hooks/pre-commit b/hooks/pre-commit index 1929ee91..662e5787 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -59,12 +59,12 @@ fi PEP8_IGNORE="E123,E501,W503" err() { - echo ERROR: "$@" + echo >&2 ERROR: "$@" exit 1 } warn() { - echo WARNING: "$@" + echo >&2 WARNING: "$@" } cmd_exists() { @@ -81,7 +81,7 @@ find_command() { fi done warn "$1 is not installed, using dummy placeholder!" - echo -n echo + echo -n : } PYFLAKES=$(find_command pyflakes)