[virt-tools-list] [virt-manager] [PATCH 4/5] tests: Upgrade pep8 to pycodestyle

Radostin Stoyanov rstoyanov1 at gmail.com
Mon Jul 24 08:26:47 UTC 2017


The PEP8 [1] project has been renamed to pycodestyle [2].

[1] https://github.com/codeclimate/pep8
[2] https://github.com/pycqa/pycodestyle
---
 HACKING.md            |  2 +-
 setup.py              |  8 ++++----
 tests/pep8.cfg        | 15 ---------------
 tests/pycodestyle.cfg | 33 +++++++++++++++++++++++++++++++++
 4 files changed, 38 insertions(+), 20 deletions(-)
 delete mode 100644 tests/pep8.cfg
 create mode 100644 tests/pycodestyle.cfg

diff --git a/HACKING.md b/HACKING.md
index a3780e0..f0e9cf5 100644
--- a/HACKING.md
+++ b/HACKING.md
@@ -7,7 +7,7 @@ python setup.py pylint    # Run a pylint script against the codebase
 ```
 
 Any patches shouldn't change the output of 'test' or 'pylint'. The
-'pylint' requires `pylint` and `python-pep8` to be installed.
+'pylint' requires `pylint` and `pycodestyle` to be installed.
 
 Our pylint script uses a blacklist rather than a whitelist approach,
 so it could throw some false positives or useless messages. If you think
diff --git a/setup.py b/setup.py
index 41b7a33..10bf932 100755
--- a/setup.py
+++ b/setup.py
@@ -566,7 +566,7 @@ class TestInitrdInject(TestBaseCommand):
 
 class CheckPylint(distutils.core.Command):
     user_options = []
-    description = "Check code using pylint and pep8"
+    description = "Check code using pylint and pycodestyle"
 
     def initialize_options(self):
         pass
@@ -582,9 +582,9 @@ class CheckPylint(distutils.core.Command):
         output_format = sys.stdout.isatty() and "colorized" or "text"
         exclude = ["virtinst/progress.py"]
 
-        print("running pep8")
-        cmd = "pep8 "
-        cmd += "--config tests/pep8.cfg "
+        print("running pycodestyle")
+        cmd = "pycodestyle "
+        cmd += "--config tests/pycodestyle.cfg "
         cmd += "--exclude %s " % ",".join(exclude)
         cmd += " ".join(files)
         os.system(cmd)
diff --git a/tests/pep8.cfg b/tests/pep8.cfg
deleted file mode 100644
index 2d61f40..0000000
--- a/tests/pep8.cfg
+++ /dev/null
@@ -1,15 +0,0 @@
-[pep8]
-
-format = pylint
-
-# E1* :            # Continuation line indents
-# E203:            # Space before : in dictionary defs
-# E221:            # Multiple spaces before operator
-#                    (warngs about column aligning assigments)
-# E241:            # Space after , column alignment nono
-# E301:            # 1 blank line between methods
-# E303:            # Too many blank lines
-# E402:            # [E402] module level import not at top of file
-# E501:            # Line too long
-
-ignore=E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E203,E221,E241,E301,E303,E402,E501
diff --git a/tests/pycodestyle.cfg b/tests/pycodestyle.cfg
new file mode 100644
index 0000000..b28011f
--- /dev/null
+++ b/tests/pycodestyle.cfg
@@ -0,0 +1,33 @@
+[pycodestyle]
+
+format = pylint
+
+# List of error codes:
+# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
+
+
+# E121: Continuation line under-indented for hanging indent
+# E122: Continuation line missing indentation or outdented
+# E123: Closing bracket does not match indentation of opening
+#       bracket's line
+# E124: Closing bracket does not match visual indentation
+# E125: Continuation line with same indent as next logical line
+# E126: Continuation line over-indented for hanging indent
+# E127: Continuation line over-indented for visual indent
+# E128: Continuation line under-indented for visual indent
+# E129: Visually indented line with same indent as next logical line
+# E131: Continuation line unaligned for hanging indent
+# E203: White-space before ':'
+# E221: Multiple spaces before operator
+# E241: Multiple spaces after ‘,’
+# E301: Expected 1 blank line, found 0
+# E303: Too many blank lines
+# E305: Expected 2 blank lines after end of function or class
+# E306: Expected 1 blank line before a nested definition
+# E402: Module level import not at top of file
+# E501: Line too long (82 > 79 characters)
+# E722: Do not use bare except, specify exception instead
+# E741: Do not use variables named ‘l’, ‘O’, or ‘I’
+
+
+ignore = E122, E123, E124, E125, E126, E127, E128, E129, E131, E203, E221, E241, E301, E303, E305, E306, E402, E501, E722, E741
-- 
2.9.4




More information about the virt-tools-list mailing list