Add import order linting using tox and flake8-import-order.

Adds two tasks:

- Add a task that just lints everything the way Galaxy's default linting is (py27-lint-imports) and don't enforce it passes on Travis.
- Add a task that just lints a subset we expect to past, hopefully we can grow this subset over time.

Once the inverse of the subset we are testing is just the blacklist, we can eliminate bothtasks and just wrap this into Galaxy's default linting.

These tasks require an older flake8 until https://github.com/PyCQA/flake8-import-order/issues/79#issuecomment-235052270 is part of a released version of flake8.
This commit is contained in:
John Chilton
2016-07-26 14:32:01 -04:00
parent 9607e528be
commit c07bbe010e
5 changed files with 39 additions and 2 deletions
+2
View File
@@ -0,0 +1,2 @@
lib/galaxy/jobs/runners/util/external.py
lib/galaxy/util/bunch.py
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
set -e
flake8 `paste .ci/flake8_lint_include_list.txt`
+5
View File
@@ -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
+5
View File
@@ -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
+22 -2
View File
@@ -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