summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-03-08 08:45:57 +0000
committerGerrit Code Review <review@openstack.org>2017-03-08 08:45:57 +0000
commit2057f1fa20d1cf6d041be1118741c75c5275e458 (patch)
tree7c2829963a4ac49747629ae0de8439ddfd6feaba
parent96504a4de02f13943c5b849e106fe71bc1e75bd5 (diff)
parentc8206d1ab6dea99e4716aee008539af56d61de42 (diff)
Merge "Run indent checks in diskimage_builder/lib" into feature/v2feature/v2
-rwxr-xr-xbin/dib-lint28
1 files changed, 16 insertions, 12 deletions
diff --git a/bin/dib-lint b/bin/dib-lint
index 078963d..db6cbd9 100755
--- a/bin/dib-lint
+++ b/bin/dib-lint
@@ -22,6 +22,7 @@ set -eu
22set -o pipefail 22set -o pipefail
23 23
24ELEMENTS_DIR=diskimage_builder/elements 24ELEMENTS_DIR=diskimage_builder/elements
25LIB_DIR=diskimage_builder/lib
25 26
26parse_exclusions() { 27parse_exclusions() {
27 # Per-file exclusions 28 # Per-file exclusions
@@ -69,13 +70,15 @@ echo "Running dib-lint in $(pwd)"
69rc=0 70rc=0
70TMPDIR=$(mktemp -d /tmp/tmp.XXXXXXXXXX) 71TMPDIR=$(mktemp -d /tmp/tmp.XXXXXXXXXX)
71trap "rm -rf $TMPDIR" EXIT 72trap "rm -rf $TMPDIR" EXIT
72for i in $(find $ELEMENTS_DIR -type f \ 73
73 -not -name \*~ \ 74# note .py files are run through flake8 directly in tox.ini
74 -not -name \#\*\# \ 75for i in $(find $ELEMENTS_DIR -type f \
75 -not -name \*.orig \ 76 -not -name \*~ \
76 -not -name \*.rst \ 77 -not -name \#\*\# \
77 -not -name \*.yaml \ 78 -not -name \*.orig \
78 -not -name \*.py \ 79 -not -name \*.rst \
80 -not -name \*.yaml \
81 -not -name \*.py \
79 -not -name \*.pyc); do 82 -not -name \*.pyc); do
80 83
81 echo "Checking $i" 84 echo "Checking $i"
@@ -89,10 +92,10 @@ for i in $(find $ELEMENTS_DIR -type f \
89 error "$i is not executable" 92 error "$i is not executable"
90 fi 93 fi
91 94
92 # run flake8 over python files. note our "dib-python" 95 # run flake8 over python files that don't have .py. Note our
93 # interpreter can confuse the magic matching being done in 96 # "dib-python" interpreter can confuse the magic matching
94 # "file" and make it think the file is not python; 97 # being done in "file" and make it think the file is not
95 # special-case it. 98 # python; special-case it.
96 if [[ "$(file -b -k --mime-type $i)" =~ "text/x-python" ]] || \ 99 if [[ "$(file -b -k --mime-type $i)" =~ "text/x-python" ]] || \
97 [[ $firstline =~ "dib-python" ]]; then 100 [[ $firstline =~ "dib-python" ]]; then
98 flake8 $i || error "$i failed flake8" 101 flake8 $i || error "$i failed flake8"
@@ -210,7 +213,8 @@ done
210 213
211echo "Checking indents..." 214echo "Checking indents..."
212 215
213for i in $(find bin $ELEMENTS_DIR -type f -and -name '*.rst' -or -type f -executable); do 216for i in $(find $ELEMENTS_DIR -type f -and -name '*.rst' -or -type f -executable) \
217 $(find $LIB_DIR -type f); do
214 # Check for tab indentation 218 # Check for tab indentation
215 if ! excluded tabindent; then 219 if ! excluded tabindent; then
216 if grep -q $'^ *\t' ${i}; then 220 if grep -q $'^ *\t' ${i}; then