[Kimchi-devel] [PATCH v2 2/2] pep8: Use blacklist instead of whitelist

Crístian Viana vianac at linux.vnet.ibm.com
Mon Oct 6 12:51:50 UTC 2014


Currently, the command "make check-local" runs the PEP8 verification
rules only on files listed in a configuration file. New files must
still be added manually and not all files are being checked.

List the files which *shouldn't* be checked against the PEP8 rules
instead of listing the files which should be checked. Also, fix the
errors on those new files.

Reasons to blacklist each file:

- src/kimchi/config.py and tests/test_config.py: those files are
  generated automatically by replacing strings inside them. We cannot
  guarantee that every line will still be shorter than 80 characters
  after replacing a text coming from an external resource.
- src/kimchi/websocket.py and src/kimchi/websockify.py: those files
  are from a 3rd party library and weren't developed by the Kimchi team,
  so we don't need to check their style.
- src/kimchi/i18n.py: this file only contains translatable strings. It
  would not be nice to wrap every line to 80 characters as they're not
  Python code but natural language text.

Signed-off-by: Crístian Viana <vianac at linux.vnet.ibm.com>
---
 Makefile.am | 48 ++----------------------------------------------
 1 file changed, 2 insertions(+), 46 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 3293d9e..98be115 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,51 +38,7 @@ EXTRA_DIST = \
 	$(NULL)
 
 
-# When fixing a file to conform with pep8, add it to the WL here.
-# So it will be checked from now on.
-PEP8_WHITELIST = \
-	plugins/__init__.py \
-	plugins/sample/__init__.py \
-	plugins/sample/model.py \
-	src/kimchid.in \
-	src/kimchi/asynctask.py \
-	src/kimchi/auth.py \
-	src/kimchi/cachebust.py \
-	src/kimchi/config.py.in \
-	src/kimchi/control/*.py \
-	src/kimchi/control/vm/*.py \
-	src/kimchi/disks.py \
-	src/kimchi/distroloader.py \
-	src/kimchi/exception.py \
-	src/kimchi/featuretests.py \
-	src/kimchi/imageinfo.py \
-	src/kimchi/iscsi.py \
-	src/kimchi/isoinfo.py \
-	src/kimchi/kvmusertests.py \
-	src/kimchi/mockmodel.py \
-	src/kimchi/model/*.py \
-	src/kimchi/objectstore.py \
-	src/kimchi/osinfo.py \
-	src/kimchi/proxy.py \
-	src/kimchi/repositories.py \
-	src/kimchi/rollbackcontext.py \
-	src/kimchi/root.py \
-	src/kimchi/scan.py \
-	src/kimchi/server.py \
-	src/kimchi/swupdate.py \
-	src/kimchi/template.py \
-	src/kimchi/utils.py \
-	src/kimchi/vmtemplate.py \
-	tests/test_config.py.in \
-	tests/test_mockmodel.py \
-	tests/test_model.py \
-	tests/test_osinfo.py \
-	tests/test_plugin.py \
-	tests/test_rest.py \
-	tests/test_rollbackcontext.py \
-	tests/test_storagepool.py \
-	tests/utils.py \
-	$(NULL)
+PEP8_BLACKLIST = src/kimchi/config.py,src/kimchi/i18n.py,src/kimchi/websocket.py,src/kimchi/websockify.py,tests/test_config.py
 
 SKIP_PYFLAKES_ERR = "\./src/kimchi/websocket\.py"
 
@@ -98,7 +54,7 @@ check-local:
 		while read LINE; do echo "$$LINE"; false; done
 
 	$(PEP8) --version
-	$(PEP8) --filename '*.py,*.py.in' $(PEP8_WHITELIST)
+	$(PEP8) --filename '*.py,*.py.in' --exclude="$(PEP8_BLACKLIST)" .
 
 
 # Link built mo files in the source tree to enable use of translations from
-- 
1.9.3




More information about the Kimchi-devel mailing list