From f7a7026c8b189d240b2452f0d9ef069df93dcc19 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sat, 6 Jan 2018 18:22:41 -0500 Subject: [PATCH] build: Enforce flake8-cleanliness in CI --- .flake8 | 2 +- .travis.yml | 2 ++ tox.ini | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index be0cadde..f97bdb63 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,5 @@ [flake8] -exclude = .git,.tox,__pycache__ +exclude = .git,.tox,__pycache__,.eggs,build max-line-length = 100 ignore = # E231 missing whitespace after ',' diff --git a/.travis.yml b/.travis.yml index df37efa5..dadc4790 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,6 +28,7 @@ install: # Twisted runs on 2.x and 3.3+, but is flaky on pypy. - if [[ $TRAVIS_PYTHON_VERSION != 'pypy'* ]]; then travis_retry pip install Twisted; fi - if [[ $TRAVIS_PYTHON_VERSION == '2.7' || $TRAVIS_PYTHON_VERSION == '3.6' ]]; then travis_retry pip install sphinx sphinx_rtd_theme; fi + - if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then travis_retry pip install flake8; fi # On travis the extension should always be built - if [[ $TRAVIS_PYTHON_VERSION != 'pypy'* ]]; then export TORNADO_EXTENSION=1; fi - travis_retry python setup.py install @@ -77,6 +78,7 @@ script: - export TORNADO_EXTENSION=0 - if [[ $TRAVIS_PYTHON_VERSION == 3.6 ]]; then cd ../docs && mkdir sphinx-out && sphinx-build -E -n -W -b html . sphinx-out; fi - if [[ $TRAVIS_PYTHON_VERSION == '2.7' || $TRAVIS_PYTHON_VERSION == 3.6 ]]; then cd ../docs && mkdir sphinx-doctest-out && sphinx-build -E -n -b doctest . sphinx-out; fi + - if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then flake8; fi after_success: # call codecov from project root diff --git a/tox.ini b/tox.ini index 603914b5..c8c4b67f 100644 --- a/tox.ini +++ b/tox.ini @@ -44,7 +44,9 @@ envlist = py3-sphinx-docs, # Run the doctests via sphinx (which covers things not run # in the regular test suite and vice versa) - {py2,py3}-sphinx-doctest + {py2,py3}-sphinx-doctest, + + py3-lint [testenv] # Most of these are defaults, but if you specify any you can't fall back @@ -79,6 +81,7 @@ deps = py2-monotonic: monotonic sphinx: sphinx sphinx: sphinx_rtd_theme + lint: flake8 setenv = # The extension is mandatory on cpython. @@ -151,3 +154,7 @@ changedir = docs setenv = TORNADO_EXTENSION=0 commands = sphinx-build -q -E -n -b doctest . {envtmpdir}/doctest + +[testenv:py3-lint] +commands = flake8 {posargs:} +changedir = {toxinidir}