... | ... |
@@ -22,8 +22,8 @@ install: |
22 | 22 |
script: |
23 | 23 |
# urllib2's defaults are not secure enough for us |
24 | 24 |
- ./test/code-smell/replace-urlopen.sh . |
25 |
-- ./test/code-smell/use-compat-six.sh . |
|
26 |
-- ./test/code-smell/boilerplate.sh . |
|
25 |
+- ./test/code-smell/use-compat-six.sh lib |
|
26 |
+- ./test/code-smell/boilerplate.sh |
|
27 | 27 |
- if test x"$TOXENV" != x'py24' ; then tox ; fi |
28 | 28 |
- if test x"$TOXENV" = x'py24' ; then python2.4 -V && python2.4 -m compileall -fq -x 'module_utils/(a10|rax|openstack|ec2|gce).py' lib/ansible/module_utils ; fi |
29 | 29 |
#- make -C docsite all |
30 | 30 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,52 @@ |
0 |
+#!/bin/sh |
|
1 |
+ |
|
2 |
+metaclass1=$(find ./bin -type f -exec grep -HL '__metaclass__ = type' \{\} \; ) |
|
3 |
+future1=$(find ./bin -type f -exec grep -HL 'from __future__ import (absolute_import, division, print_function)' \{\} \;) |
|
4 |
+ |
|
5 |
+metaclass2=$(find ./lib/ansible -path ./lib/ansible/modules/core -prune \ |
|
6 |
+ -o -path ./lib/ansible/modules/extras -prune \ |
|
7 |
+ -o -path ./lib/ansible/module_utils -prune \ |
|
8 |
+ -o -path ./lib/ansible/compat/six/_six.py -prune \ |
|
9 |
+ -o -path ./lib/ansible/utils/module_docs_fragments -prune \ |
|
10 |
+ -o -name '*.py' -exec grep -HL '__metaclass__ = type' \{\} \;) |
|
11 |
+ |
|
12 |
+future2=$(find ./lib/ansible -path ./lib/ansible/modules/core -prune \ |
|
13 |
+ -o -path ./lib/ansible/modules/extras -prune \ |
|
14 |
+ -o -path ./lib/ansible/module_utils -prune \ |
|
15 |
+ -o -path ./lib/ansible/compat/six/_six.py -prune \ |
|
16 |
+ -o -path ./lib/ansible/utils/module_docs_fragments -prune \ |
|
17 |
+ -o -name '*.py' -exec grep -HL 'from __future__ import (absolute_import, division, print_function)' \{\} \;) |
|
18 |
+ |
|
19 |
+### TODO: |
|
20 |
+### - contrib/ |
|
21 |
+### - module_utils that are py2.6+ |
|
22 |
+ |
|
23 |
+ |
|
24 |
+if test -n "$metaclass1" -o -n "$metaclass2" ; then |
|
25 |
+printf "\n== Missing __metaclass__ = type ==\n" |
|
26 |
+fi |
|
27 |
+ |
|
28 |
+if test -n "$metaclass1" ; then |
|
29 |
+ printf "$metaclass1\n" |
|
30 |
+fi |
|
31 |
+if test -n "$metaclass2" ; then |
|
32 |
+ printf "$metaclass2\n" |
|
33 |
+fi |
|
34 |
+ |
|
35 |
+if test -n "$future1" -o -n "$future2" ; then |
|
36 |
+ printf "\n== Missing from __future__ import (absolute_import, division, print_function) ==\n" |
|
37 |
+fi |
|
38 |
+ |
|
39 |
+if test -n "$future1" ; then |
|
40 |
+ printf "$future1\n" |
|
41 |
+fi |
|
42 |
+if test -n "$future2" ; then |
|
43 |
+ printf "$future2\n" |
|
44 |
+fi |
|
45 |
+ |
|
46 |
+if test -n "$future1$future2$metaclass1$metaclass2" ; then |
|
47 |
+ failures=$(printf "$future1$future2$metaclass1$metaclass2"| wc -l) |
|
48 |
+ failures=$(expr $failures + 2) |
|
49 |
+ exit $failures |
|
50 |
+fi |
|
51 |
+exit 0 |