Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/tests/pep8.py')
-rw-r--r--source/tests/pep8.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/source/tests/pep8.py b/source/tests/pep8.py
index ee71c877533..f7c416553b2 100644
--- a/source/tests/pep8.py
+++ b/source/tests/pep8.py
@@ -31,7 +31,7 @@ import os
# in debian install pylint pyflakes pep8 with apt-get/aptitude/etc
#
# on *nix run
-# python release/test/pep8.py > pep8_error.txt 2>&1
+# python source/tests/pep8.py > test_pep8.log 2>&1
# how many lines to read into the file, pep8 comment
# should be directly after the licence header, ~20 in most cases
@@ -42,7 +42,7 @@ SKIP_PREFIX = "./tools", "./config", "./scons", "./extern"
def file_list_py(path):
for dirpath, dirnames, filenames in os.walk(path):
for filename in filenames:
- if filename.endswith(".py"):
+ if filename.endswith(".py") or filename.endswith(".cfg"):
yield os.path.join(dirpath, filename)
@@ -87,7 +87,15 @@ def main():
for f in files_skip:
print(" %s" % f)
- # pyflakes
+ # strict imports
+ print("\n\n\n# running pep8...")
+ import re
+ import_check = re.compile(r"\s*from\s+[A-z\.]+\s+import \*\s*")
+ for f, pep8_type in files:
+ for i, l in enumerate(open(f, 'r', encoding='utf8')):
+ if import_check.match(l):
+ print("%s:%d:0: global import bad practice" % (f, i + 1))
+
print("\n\n\n# running pep8...")
for f, pep8_type in files:
if pep8_type == 1:
@@ -96,6 +104,7 @@ def main():
else:
os.system("pep8 --repeat '%s'" % (f))
+ # pyflakes
print("\n\n\n# running pyflakes...")
for f, pep8_type in files:
os.system("pyflakes '%s'" % f)