From d21eb80277c6b6eb720b74f4bc828c67fc142a22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9na=C3=AFc=20Huard?= Date: Fri, 17 Jul 2015 14:45:48 +0200 Subject: Fix git/pylint.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a PR contains no python file, the very last command executed by `git/pylint.sh` is `git diff --name-only … | grep ".py$"`. This command exits with a non-zero exit code because grep has no match. Because of the `set -e` option, the script aborts there immediately. When a PR contains python files, `git/pylint.sh` exit code must be the one of `pylint` When a PR doesn’t contain any python file, `git/pylint.sh` exit code must be 0. --- git/pylint.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'git/pylint.sh') diff --git a/git/pylint.sh b/git/pylint.sh index 86ea52d45..8666931e9 100755 --- a/git/pylint.sh +++ b/git/pylint.sh @@ -15,7 +15,9 @@ NEWREV=$2 PYTHON=/var/lib/jenkins/python27/bin/python +set +e PY_DIFF=$(/usr/bin/git diff --name-only $OLDREV $NEWREV --diff-filter=ACM | grep ".py$") +set -e FILES_TO_TEST="" @@ -40,5 +42,7 @@ done if [ "${FILES_TO_TEST}" != "" ]; then echo "Testing files: ${FILES_TO_TEST}" - ${PYTHON} -m pylint --rcfile ${WORKSPACE}/git/.pylintrc ${FILES_TO_TEST} + exec ${PYTHON} -m pylint --rcfile ${WORKSPACE}/git/.pylintrc ${FILES_TO_TEST} +else + exit 0 fi -- cgit v1.2.3