Use flake8-import-order plugin

In reviews we usually check import grouping but it is boring.
By using flake8-import-order plugin, we can avoid this.
It enforces loose checking so it sounds good to use it.
This flake8 plugin is already used in tempest.

Note that flake8-import-order version is pinned to avoid unexpected
breakage of pep8 job.

Setup for unit tests of hacking rules is tweaked to disable
flake8-import-order checks. This extension assumes an actual file exists
and causes hacking rule unit tests.

application-import-names needs to be specified in tox.ini
to ensure application imports are placed after third-party imports.

Change-Id: If2067b950737ae7ebc65b2311955754be795758f
This commit is contained in:
Akihiro Motoki 2017-08-19 07:42:08 +00:00
parent a8e81ddc55
commit 55337ba80a
3 changed files with 7 additions and 1 deletions

View File

@ -20,10 +20,11 @@ HORIZON_CONFIG.pop('dashboards', None)
HORIZON_CONFIG.pop('default_dashboard', None)
# Update the dashboards with neutron_vpnaas_dashboard
import neutron_vpnaas_dashboard.enabled
import openstack_dashboard.enabled
from openstack_dashboard.utils import settings
import neutron_vpnaas_dashboard.enabled
settings.update_dashboards(
[
openstack_dashboard.enabled,

View File

@ -7,6 +7,7 @@ hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
django-nose>=1.4.4 # BSD
flake8-import-order==0.13 # LGPLv3
mock>=2.0.0 # BSD
mox3!=0.19.0,>=0.7.0 # Apache-2.0
python-subunit>=0.0.18 # Apache-2.0/BSD

View File

@ -57,5 +57,9 @@ exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,node_modules
enable-extensions=H203,H904
max-complexity = 20
# flake8-import-order configurations
import-order-style = pep8
application-import-names = neutron_vpnaas_dashboard
[hacking]
local-check-factory = horizon.hacking.checks.factory