Nir Soffer has uploaded a new change for review.

Change subject: build: Replace pep8 and pyflakes with flake8
......................................................................

build: Replace pep8 and pyflakes with flake8

flake8 is an extensible and configurable tool combining pep8, pyflakes
and other plugins.

This patch replace the pep8 and pyflakes targets with single flake8
target, and remove the complex and ugly tox.sh. Everyting is configured
in a simple way in tox.ini.

Since this version includes the newers versions of pyflakes and pep8, we are
ignoring some new errors and warnings. See tox.ini for the details.

To disable ignored warnings and errors, you can:

    tox -- --ignore=''

I enabled the --show-source option by default, so now we see exactly
where is the error:

    ./tests/functional/networkTests.py:465:29: W503 line break before binary 
operator
                                <= (ARP_REQUEST_SIZE + DHCP_PACKET_SIZE),

I also enabled the --statistics option, showing:

    26    E123 closing bracket does not match indentation of opening bracket's 
line
    32    E226 missing whitespace around arithmetic operator
    45    E241 multiple spaces after ','
    31    E402 module level import not at top of file
    25    E731 do not assign a lambda expression, use a def
    24    W503 line break before binary operator

For more info see http://flake8.pycqa.org

Change-Id: Ib42430f045e4475c31cd370b4196214094c29cd1
Signed-off-by: Nir Soffer <nsof...@redhat.com>
---
M Makefile.am
M contrib/shell_helper
M tox.ini
D tox.sh
4 files changed, 38 insertions(+), 65 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/03/65403/1

diff --git a/Makefile.am b/Makefile.am
index 789221c..354c6b3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -58,7 +58,6 @@
        vdsm.spec \
        vdsm.spec.in \
        tox.ini \
-       tox.sh \
        $(NULL)
 
 CLEANFILES = \
@@ -88,19 +87,9 @@
            echo "Missing absolute_import in $$f"; exit 1; fi; \
        done;
 
-PYTHON_CHECKERS = pyflakes pep8
-
-.PHONY: py_checkers
-py_checkers:
-       tox -- $(PYTHON_CHECKERS)
-
-.PHONY: pyflakes
-pyflakes: tox
-       tox -- pyflakes
-
-.PHONY: pep8
-pep8: tox
-       tox -- pep8
+.PHONY: flake8
+flake8: tox
+       tox -e flake8
 
 .PHONY: tox
 tox:
@@ -127,7 +116,7 @@
        fi
 
 # Note: dependencies ordered by time needed to run them
-check: gitignore abs_imports python3 py_checkers tests
+check: gitignore abs_imports python3 flake8 tests
 
 check-recursive:
        @true
diff --git a/contrib/shell_helper b/contrib/shell_helper
index 77f8422..2d4dc65 100755
--- a/contrib/shell_helper
+++ b/contrib/shell_helper
@@ -199,9 +199,9 @@
     del_net_persistency
 }
 
-vdsm_pep8() {
+vdsm_flake8() {
     pushd $VDSM_DIR
-    ./autogen.sh --system && ./configure && make pep8
+    ./autogen.sh --system && ./configure && make flake8
     popd
 }
 
diff --git a/tox.ini b/tox.ini
index d567ec1..8686eb2 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,10 +1,37 @@
 [tox]
-envlist = py27
+envlist = flake8
 skipsdist = true
 
-[testenv:py27]
+[testenv:flake8]
 deps =
-    pyflakes==1.0.0
-    pep8==1.5.7
+    flake8
 commands=
-    {toxinidir}/tox.sh {posargs}
+    flake8 --statistics {posargs} \
+        . \
+        build-aux/vercmp \
+        contrib/logdb \
+        contrib/logstat \
+        contrib/profile-stats \
+        init/daemonAdapter \
+        vdsm-tool/vdsm-tool \
+        vdsm/get-conf-item \
+        vdsm/set-conf-item \
+        vdsm/storage/curl-img-wrap \
+        vdsm/storage/fc-scan \
+        vdsm/supervdsmServer \
+        vdsm/vdsm \
+        vdsm/vdsm-restore-net-config
+
+[flake8]
+
+# Ignore errors in current code to make the build pass
+# 26    E123 closing bracket does not match indentation of opening bracket's 
line
+# 32    E226 missing whitespace around arithmetic operator
+# 45    E241 multiple spaces after ','
+# 31    E402 module level import not at top of file
+# 25    E731 do not assign a lambda expression, use a def
+# 24    W503 line break before binary operator
+# TODO: fix the code and eliminate these ignores
+ignore = E123, E226, E241, E402, E731, W503
+
+show_source = True
diff --git a/tox.sh b/tox.sh
deleted file mode 100755
index f85c013..0000000
--- a/tox.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/sh -e
-
-WHITELIST=(build-aux/vercmp \
-           contrib/logdb \
-           contrib/logstat \
-           contrib/profile-stats \
-           init/daemonAdapter \
-           vdsm/get-conf-item \
-           vdsm/set-conf-item \
-           vdsm/supervdsmServer \
-           vdsm/vdsm \
-           vdsm/vdsm-restore-net-config \
-           vdsm/storage/curl-img-wrap \
-           vdsm/storage/fc-scan \
-           vdsm-tool/vdsm-tool
-          )
-
-SKIP_PYFLAKES_ERR="\./vdsm/storage/lvm\.py.*: list comprehension redefines \
-       'lv' from line .*"
-
-PEP8_BLACKLIST=(config.py \
-                constants.py \
-                crossImportsTests.py \
-                vdsm.py \
-               )
-
-for checker in "$@"; do
-    if [ 'pyflakes' = "$checker" ]; then
-        (find . -path './.tox' -prune -type f -o \
-            -path './.git' -prune -type f -o \
-            -path './.ropeproject' -prune -type f -o \
-            -name '*.py' && echo "${WHITELIST[@]}") | \
-            xargs pyflakes | grep -w -v "${SKIP_PYFLAKES_ERR}" | \
-            while read LINE; do echo "$LINE"; false; done
-    elif [ 'pep8' = "$checker" ]; then
-        for x in ${PEP8_BLACKLIST[@]}; do \
-        exclude="${exclude},${x}" ; \
-            done ; \
-            pep8 --exclude="${exclude},.tox,.ropeproject" \
-            --filename '*.py' . \
-            "${WHITELIST[@]}"
-    fi
-done


-- 
To view, visit https://gerrit.ovirt.org/65403
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib42430f045e4475c31cd370b4196214094c29cd1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsof...@redhat.com>
_______________________________________________
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org

Reply via email to