summaryrefslogtreecommitdiff
path: root/tools/run-pep8
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2016-03-03 16:20:10 -0600
committerRyan Harper <ryan.harper@canonical.com>2016-03-03 16:20:10 -0600
commit8cb7c3f7b5339e686bfbf95996b51afafeaf9c9e (patch)
tree6892cca7fb6c81ed150d037a192b9a9d0e30068b /tools/run-pep8
parent9a3a490fadc5b61e0fa14cde2d4f79164115ae25 (diff)
downloadvyos-cloud-init-8cb7c3f7b5339e686bfbf95996b51afafeaf9c9e.tar.gz
vyos-cloud-init-8cb7c3f7b5339e686bfbf95996b51afafeaf9c9e.zip
Update pep8 runner and fix pep8 issues
Diffstat (limited to 'tools/run-pep8')
-rwxr-xr-xtools/run-pep851
1 files changed, 17 insertions, 34 deletions
diff --git a/tools/run-pep8 b/tools/run-pep8
index ccd6be5a..086400fc 100755
--- a/tools/run-pep8
+++ b/tools/run-pep8
@@ -1,39 +1,22 @@
#!/bin/bash
-if [ $# -eq 0 ]; then
- files=( bin/cloud-init $(find * -name "*.py" -type f) )
+pycheck_dirs=( "cloudinit/" "bin/" "tests/" "tools/" )
+# FIXME: cloud-init modifies sys module path, pep8 does not like
+# bin_files=( "bin/cloud-init" )
+CR="
+"
+[ "$1" = "-v" ] && { verbose="$1"; shift; } || verbose=""
+
+set -f
+if [ $# -eq 0 ]; then unset IFS
+ IFS="$CR"
+ files=( "${bin_files[@]}" "${pycheck_dirs[@]}" )
+ unset IFS
else
- files=( "$@" );
+ files=( "$@" )
fi
-if [ -f 'hacking.py' ]
-then
- base=`pwd`
-else
- base=`pwd`/tools/
-fi
-
-IGNORE=""
-
-# King Arthur: Be quiet! ... Be Quiet! I Order You to Be Quiet.
-IGNORE="$IGNORE,E121" # Continuation line indentation is not a multiple of four
-IGNORE="$IGNORE,E123" # Closing bracket does not match indentation of opening bracket's line
-IGNORE="$IGNORE,E124" # Closing bracket missing visual indentation
-IGNORE="$IGNORE,E125" # Continuation line does not distinguish itself from next logical line
-IGNORE="$IGNORE,E126" # Continuation line over-indented for hanging indent
-IGNORE="$IGNORE,E127" # Continuation line over-indented for visual indent
-IGNORE="$IGNORE,E128" # Continuation line under-indented for visual indent
-IGNORE="$IGNORE,E502" # The backslash is redundant between brackets
-IGNORE="${IGNORE#,}" # remove the leading ',' added above
-
-cmd=(
- ${base}/hacking.py
-
- --ignore="$IGNORE"
-
- "${files[@]}"
-)
-
-echo -e "\nRunning 'cloudinit' pep8:"
-echo "${cmd[@]}"
-"${cmd[@]}"
+myname=${0##*/}
+cmd=( "${myname#run-}" $verbose "${files[@]}" )
+echo "Running: " "${cmd[@]}" 1>&2
+exec "${cmd[@]}"