diff --git a/.ci/flake8_lint_include_list.txt b/.ci/flake8_lint_include_list.txt new file mode 100644 index 00000000000..9c35c64a1ea --- /dev/null +++ b/.ci/flake8_lint_include_list.txt @@ -0,0 +1,2 @@ +lib/galaxy/jobs/runners/util/external.py +lib/galaxy/util/bunch.py diff --git a/.ci/flake8_wrapper_imports.sh b/.ci/flake8_wrapper_imports.sh new file mode 100755 index 00000000000..22afed26991 --- /dev/null +++ b/.ci/flake8_wrapper_imports.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +set -e + +flake8 `paste .ci/flake8_lint_include_list.txt` diff --git a/.travis.yml b/.travis.yml index 83463757ea4..2cae00653ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,9 @@ env: - TOX_ENV=py27-unit - TOX_ENV=qunit - TOX_ENV=first_startup + - TOX_ENV=py27-lint-imports + - TOX_ENV=py27-lint-imports-include-list + matrix: include: - os: osx @@ -16,6 +19,8 @@ matrix: - os: osx env: TOX_ENV=py27-unit language: generic + allow_failures: + - env: TOX_ENV=py27-lint-imports before_install: - if [ `uname` == "Darwin" ]; then bash -c "brew update && brew install python"; fi diff --git a/setup.cfg b/setup.cfg index 102507b9b14..4ae1306d579 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,3 +7,8 @@ # 501 is line length # W503 is line breaks before binary operators, which has been reversed in PEP 8. ignore = E128,E201,E202,E203,E501,E402,W503 + +# For flake8-import-order +# https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_smarkets.py +import-order-style = smarkets +application-import-names = galaxy diff --git a/tox.ini b/tox.ini index 17abc6c9fb2..4045ed3646e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,7 @@ [tox] -envlist = py27-lint, py27-unit, qunit, mako-count, web-controller-line-count, py33-lint, py34-lint, py35-lint +envlist = py27-lint, py27-lint-imports, py27-lint-imports-include-list, py27-unit, qunit, mako-count, web-controller-line-count, py33-lint, py34-lint, py35-lint skipsdist = True - [testenv:py27-lint] commands = bash .ci/flake8_wrapper.sh whitelist_externals = bash @@ -31,6 +30,27 @@ deps = NoseHTML mock +# Setup tox environments for linting all of Galaxy for imports and +# just a subset we expect to pass (the include import list). Once the +# include list is reduced to just the inverse of Galaxy's linting +# blacklist these can both just be removed and flake8-import-order can +# be added as a dependency to Galaxy's main linting task. +[testenv:py27-lint-imports] +commands = bash .ci/flake8_wrapper.sh +whitelist_externals = bash +skip_install = True +deps = + flake8<3 + flake8-import-order + +[testenv:py27-lint-imports-include-list] +commands = bash .ci/flake8_wrapper_imports.sh +whitelist_externals = bash +skip_install = True +deps = + flake8<3 + flake8-import-order + [testenv:qunit] commands = bash run_tests.sh -q whitelist_externals = bash