[pygobject] autotools: use flake8 instead of pep8/pyflakes



commit 722ef028739b1e3e585f49418a98efa98834bc02
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Fri Jan 19 20:34:04 2018 +0100

    autotools: use flake8 instead of pep8/pyflakes
    
    flake8 uses pep8/pycodestyle/pyflakes internally, so there should not
    by any difference.
    
    The nice thing about it is that we can store the configuration in
    setup.cfg and linting comes down to just executing "flake8".
    It also allows to ignore warnings with inline comments, so that
    when avoiding a warning isn't possible it doesn't need to be disabled
    for the whole codebase.

 .gitlab-ci/test-docker.sh          |  2 +-
 MANIFEST.in                        |  1 +
 Makefile.am                        | 19 +++----------------
 docs/devguide/building_testing.rst |  2 +-
 setup.cfg                          |  3 +++
 5 files changed, 9 insertions(+), 18 deletions(-)
---
diff --git a/.gitlab-ci/test-docker.sh b/.gitlab-ci/test-docker.sh
index 6473541c..e0386b60 100755
--- a/.gitlab-ci/test-docker.sh
+++ b/.gitlab-ci/test-docker.sh
@@ -6,7 +6,7 @@ virtualenv --python="${PYTHON}" /tmp/venv
 source /tmp/venv/bin/activate
 
 python -m pip install git+https://github.com/pygobject/pycairo.git
-python -m pip install pyflakes pycodestyle pep8
+python -m pip install flake8
 
 export PKG_CONFIG_PATH=/tmp/venv/share/pkgconfig
 export MALLOC_CHECK_=3
diff --git a/MANIFEST.in b/MANIFEST.in
index bfb56e5c..a4486fb3 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,3 +1,4 @@
+include setup.cfg
 include *.am
 include autogen.sh
 include configure.ac
diff --git a/Makefile.am b/Makefile.am
index 5656d80c..0fbf3ccd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,10 +1,7 @@
-# Limit PyFlakes and PEP8 to these directories.
-pycheck_dirs = examples gi tests pygtkcompat
-
 # Part of the gi subdirectory is handled with non-recursive make to avoid
 # py-compile getting confused between gi/types.py and Python's standard
 # types module.
-SUBDIRS = . $(pycheck_dirs)
+SUBDIRS = . examples gi tests pygtkcompat
 
 PLATFORM_VERSION = 3.0
 
@@ -21,6 +18,7 @@ EXTRA_DIST = \
        m4/python.m4 \
        m4/introspection.m4 \
        setup.py \
+       setup.cfg \
        MANIFEST.in \
        README.rst \
        docs
@@ -145,19 +143,8 @@ dist-hook: $(BUILT_EXTRA_DIST)
          rm -f $(distdir)/$$f && cp $$d/$$f $(distdir) || exit 1; done
        rm -rf "$(distdir)/docs/_build"
 
-# pycheck_subdirs = 
-
 check.quality:
-       @echo "  CHECK  Pyflakes" $(pycheck_dirs)
-       @if type pyflakes >/dev/null 2>&1; then \
-               (cd $(abs_top_srcdir) && PYFLAKES_BUILTINS="basestring,long,unicode" pyflakes $(pycheck_dirs) 
); \
-       else echo "skipped, pyflakes not installed"; \
-       fi
-       @echo "  CHECK  PEP8";
-       @if type pep8 >/dev/null 2>&1; then \
-               (cd $(abs_top_srcdir) && pep8 --ignore=E501,E123,E124,E402,E731,E722 --repeat --show-source 
$(pycheck_dirs) ); \
-       else echo "skipped, pep8 not installed"; \
-       fi
+       (cd $(abs_top_srcdir) && $(PYTHON) -m flake8);
 
 check.gdb:
        cd tests && $(MAKE) check.gdb
diff --git a/docs/devguide/building_testing.rst b/docs/devguide/building_testing.rst
index 4ec792a5..901f3ea4 100644
--- a/docs/devguide/building_testing.rst
+++ b/docs/devguide/building_testing.rst
@@ -38,7 +38,7 @@ To executes all the tests in valgrind::
 
     make check.valgrind
 
-To execute pyflakes and pep8 tests::
+To execute flake8 tests::
 
     make check.quality
 
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 00000000..5933e6a0
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,3 @@
+[flake8]
+ignore=E501,E123,E124,E402,E731,E722
+builtins=long,unicode,basestring


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]