summaryrefslogtreecommitdiffstats
path: root/git/pylint.sh
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2015-10-29 11:14:51 -0400
committerKenny Woodson <kwoodson@redhat.com>2015-10-29 11:14:51 -0400
commit9bbaa824da5e1a049cdec1a6523c3841d713386c (patch)
tree93e80f1577ad0f2f5f8931b493c50cd9aa657c77 /git/pylint.sh
parent15df494fb781dd1509854eeb366e981930b52c22 (diff)
parent16d1bce0be2f8c3942489630adcb7030aecadc55 (diff)
downloadopenshift-9bbaa824da5e1a049cdec1a6523c3841d713386c.tar.gz
openshift-9bbaa824da5e1a049cdec1a6523c3841d713386c.tar.bz2
openshift-9bbaa824da5e1a049cdec1a6523c3841d713386c.tar.xz
openshift-9bbaa824da5e1a049cdec1a6523c3841d713386c.zip
Merge pull request #763 from openshift/master
Merge master into prod.
Diffstat (limited to 'git/pylint.sh')
-rwxr-xr-xgit/pylint.sh46
1 files changed, 40 insertions, 6 deletions
diff --git a/git/pylint.sh b/git/pylint.sh
index 286747565..55e8b6131 100755
--- a/git/pylint.sh
+++ b/git/pylint.sh
@@ -1,14 +1,48 @@
#!/usr/bin/env bash
+set -eu
+ANSIBLE_UPSTREAM_FILES=(
+ 'inventory/aws/hosts/ec2.py'
+ 'inventory/gce/hosts/gce.py'
+ 'inventory/libvirt/hosts/libvirt_generic.py'
+ 'inventory/openstack/hosts/nova.py'
+ 'lookup_plugins/sequence.py'
+ )
OLDREV=$1
NEWREV=$2
-TRG_BRANCH=$3
+#TRG_BRANCH=$3
-PYTHON=/var/lib/jenkins/python27/bin/python
+PYTHON=$(which python)
-/usr/bin/git diff --name-only $OLDREV $NEWREV --diff-filter=ACM | \
- grep ".py$" | \
- xargs -r -I{} ${PYTHON} -m pylint --rcfile ${WORKSPACE}/git/.pylintrc {}
+set +e
+PY_DIFF=$(/usr/bin/git diff --name-only $OLDREV $NEWREV --diff-filter=ACM | grep ".py$")
+set -e
-exit $?
+FILES_TO_TEST=""
+
+for PY_FILE in $PY_DIFF; do
+ IGNORE_FILE=false
+ for UPSTREAM_FILE in "${ANSIBLE_UPSTREAM_FILES[@]}"; do
+ if [ "${PY_FILE}" == "${UPSTREAM_FILE}" ]; then
+ IGNORE_FILE=true
+ break
+ fi
+ done
+
+ if [ "${IGNORE_FILE}" == true ]; then
+ echo "Skipping file ${PY_FILE} as an upstream Ansible file..."
+ continue
+ fi
+
+ if [ -e "${PY_FILE}" ]; then
+ FILES_TO_TEST="${FILES_TO_TEST} ${PY_FILE}"
+ fi
+done
+
+if [ "${FILES_TO_TEST}" != "" ]; then
+ echo "Testing files: ${FILES_TO_TEST}"
+ exec ${PYTHON} -m pylint --rcfile ${WORKSPACE}/git/.pylintrc ${FILES_TO_TEST}
+else
+ exit 0
+fi