summaryrefslogtreecommitdiffstats
path: root/git
diff options
context:
space:
mode:
authorJason DeTiberus <jdetiber@redhat.com>2015-07-10 13:36:52 -0400
committerJason DeTiberus <jdetiber@redhat.com>2015-07-10 13:36:52 -0400
commit4e2ccc174f033c72b5b5aa02989d0e350e67a3da (patch)
treedd84481463b2333df100e4a28fe36ebf6a9fc973 /git
parent9cd8ad65fea0b637a4fbf709f419f9c11785c3e9 (diff)
downloadopenshift-4e2ccc174f033c72b5b5aa02989d0e350e67a3da.tar.gz
openshift-4e2ccc174f033c72b5b5aa02989d0e350e67a3da.tar.bz2
openshift-4e2ccc174f033c72b5b5aa02989d0e350e67a3da.tar.xz
openshift-4e2ccc174f033c72b5b5aa02989d0e350e67a3da.zip
Add ability to skip pylint checking for upstream ansible files
Diffstat (limited to 'git')
-rwxr-xr-xgit/pylint.sh40
1 files changed, 35 insertions, 5 deletions
diff --git a/git/pylint.sh b/git/pylint.sh
index 286747565..86ea52d45 100755
--- a/git/pylint.sh
+++ b/git/pylint.sh
@@ -1,14 +1,44 @@
#!/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
-/usr/bin/git diff --name-only $OLDREV $NEWREV --diff-filter=ACM | \
- grep ".py$" | \
- xargs -r -I{} ${PYTHON} -m pylint --rcfile ${WORKSPACE}/git/.pylintrc {}
+PY_DIFF=$(/usr/bin/git diff --name-only $OLDREV $NEWREV --diff-filter=ACM | grep ".py$")
-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}"
+ ${PYTHON} -m pylint --rcfile ${WORKSPACE}/git/.pylintrc ${FILES_TO_TEST}
+fi