summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2012-01-17 15:59:21 -0500
committerScott Moser <smoser@ubuntu.com>2012-01-17 15:59:21 -0500
commit1e746f00edbf478cf0ae43b66ff7899b6819fa33 (patch)
tree533a5f7b80ce1ec9a5cd2c670d2a781b6a54a4f1 /tools
parentd4c5cfd23e693959a1478e4bf59a08e4dce9ca6c (diff)
parentdcb543887bcb0770bbb7b102e9d6a7c732d0228d (diff)
downloadvyos-cloud-init-1e746f00edbf478cf0ae43b66ff7899b6819fa33.tar.gz
vyos-cloud-init-1e746f00edbf478cf0ae43b66ff7899b6819fa33.zip
miscellaneous cleanups, and add tools/run-pylint
adding run-pylint makes it easy to run pylint with given configuration against the code.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/run-pylint49
1 files changed, 49 insertions, 0 deletions
diff --git a/tools/run-pylint b/tools/run-pylint
new file mode 100755
index 00000000..e271c3d5
--- /dev/null
+++ b/tools/run-pylint
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+def_files='cloud*.py cloudinit/*.py cloudinit/CloudConfig/*.py'
+
+if [ $# -eq 0 ]; then
+ files=( )
+ for f in $def_files; do
+ [ -f "$f" ] || { echo "failed, $f not a file" 1>&2; exit 1; }
+ files[${#files[@]}]=${f}
+ done
+else
+ files=( "$@" );
+fi
+
+cmd=(
+ pylint
+ --reports=n
+ --include-ids=y
+ --max-line-length=79
+
+ --disable=R
+ --disable=I
+
+ --disable=W0142 # Used * or ** magic
+ --disable=W0511 # TODO/FIXME note
+ --disable=W0702 # No exception type(s) specified
+ --disable=W0703 # Catch "Exception"
+
+ --disable=C0103 # Invalid name
+ --disable=C0111 # Missing docstring
+
+ "${files[@]}"
+)
+
+echo -e "\nRunning pylint:"
+echo "${cmd[@]}"
+"${cmd[@]}"
+
+cmd=(
+ pep8
+
+ --ignore=E501 # Line too long (these are caught by pylint above)
+
+ "${files[@]}"
+)
+
+echo -e "\nRunning pep8:"
+echo "${cmd[@]}"
+"${cmd[@]}"