diff options
author | Lénaïc Huard <lhuard@amadeus.com> | 2015-07-17 14:45:48 +0200 |
---|---|---|
committer | Lénaïc Huard <lhuard@amadeus.com> | 2015-07-17 15:07:53 +0200 |
commit | d21eb80277c6b6eb720b74f4bc828c67fc142a22 (patch) | |
tree | 977ae756f36e1b04fd9d3a41430bf6dd21120753 /git | |
parent | e0211ca67ce18fc9f74d0a9c82cf14a28f395e4d (diff) | |
download | openshift-d21eb80277c6b6eb720b74f4bc828c67fc142a22.tar.gz openshift-d21eb80277c6b6eb720b74f4bc828c67fc142a22.tar.bz2 openshift-d21eb80277c6b6eb720b74f4bc828c67fc142a22.tar.xz openshift-d21eb80277c6b6eb720b74f4bc828c67fc142a22.zip |
Fix git/pylint.sh
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.
Diffstat (limited to 'git')
-rwxr-xr-x | git/pylint.sh | 6 |
1 files changed, 5 insertions, 1 deletions
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 |