Add flake8-import-order and use python3.9 on tox
Improving the code quality of upstream by adding the flake8 check on zuul and adding the flake8-import-order plugin to standardize imports. Also, defaults testenv to python3.9 configuration that should be used for now on with the debian migration. Story: 2010100 Task: 45669 Signed-off-by: Thiago Brito <thiago.brito@windriver.com> Change-Id: I55aa952c4f22a7af53e1f1c11a4a51997afa4bcf
This commit is contained in:
parent
1b989b481a
commit
4d34b1ac65
18
.zuul.yaml
18
.zuul.yaml
@ -5,16 +5,26 @@
|
|||||||
- stx-release-notes-jobs
|
- stx-release-notes-jobs
|
||||||
check:
|
check:
|
||||||
jobs:
|
jobs:
|
||||||
- openstack-tox-pep8
|
- stx-upstream-tox-pep8
|
||||||
- openstack-tox-linters
|
- stx-upstream-tox-linters
|
||||||
gate:
|
gate:
|
||||||
jobs:
|
jobs:
|
||||||
- openstack-tox-pep8
|
- stx-upstream-tox-pep8
|
||||||
- openstack-tox-linters
|
- stx-upstream-tox-linters
|
||||||
post:
|
post:
|
||||||
jobs:
|
jobs:
|
||||||
- stx-upstream-upload-git-mirror
|
- stx-upstream-upload-git-mirror
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: stx-upstream-tox-pep8
|
||||||
|
parent: openstack-tox-pep8
|
||||||
|
nodeset: debian-bullseye
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: stx-upstream-tox-linters
|
||||||
|
parent: openstack-tox-linters
|
||||||
|
nodeset: debian-bullseye
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: stx-upstream-upload-git-mirror
|
name: stx-upstream-upload-git-mirror
|
||||||
parent: upload-git-mirror
|
parent: upload-git-mirror
|
||||||
|
@ -3,6 +3,7 @@ import fnmatch
|
|||||||
import os
|
import os
|
||||||
import resource
|
import resource
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,10 +12,11 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
from keystone.server import wsgi as wsgi_server
|
from keystone.server import wsgi as wsgi_server
|
||||||
|
|
||||||
import sys
|
|
||||||
sys.argv = sys.argv[:1]
|
sys.argv = sys.argv[:1]
|
||||||
|
|
||||||
application = wsgi_server.initialize_public_application()
|
application = wsgi_server.initialize_public_application()
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
bashate >= 0.2
|
bashate
|
||||||
PyYAML >= 3.1.0
|
PyYAML
|
||||||
yamllint >= 0.5.2
|
yamllint
|
||||||
flake8 >= 2.5.4 # MIT
|
flake8
|
||||||
|
flake8-import-order
|
||||||
|
33
tox.ini
33
tox.ini
@ -4,7 +4,12 @@ minversion = 2.3
|
|||||||
skipsdist = True
|
skipsdist = True
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
install_command = pip install -U {opts} {packages}
|
basepython = python3.9
|
||||||
|
install_command = pip install \
|
||||||
|
-v -v -v \
|
||||||
|
-U \
|
||||||
|
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
|
||||||
|
{opts} {packages}
|
||||||
setenv = VIRTUAL_ENV={envdir}
|
setenv = VIRTUAL_ENV={envdir}
|
||||||
OS_STDOUT_CAPTURE=1
|
OS_STDOUT_CAPTURE=1
|
||||||
OS_STDERR_CAPTURE=1
|
OS_STDERR_CAPTURE=1
|
||||||
@ -12,7 +17,6 @@ setenv = VIRTUAL_ENV={envdir}
|
|||||||
deps = -r{toxinidir}/test-requirements.txt
|
deps = -r{toxinidir}/test-requirements.txt
|
||||||
|
|
||||||
[testenv:linters]
|
[testenv:linters]
|
||||||
basepython = python3
|
|
||||||
whitelist_externals = bash
|
whitelist_externals = bash
|
||||||
commands =
|
commands =
|
||||||
bash -c "find {toxinidir} \
|
bash -c "find {toxinidir} \
|
||||||
@ -27,17 +31,6 @@ commands =
|
|||||||
-o -name '*.yaml' \
|
-o -name '*.yaml' \
|
||||||
-print0 | xargs -0 yamllint"
|
-print0 | xargs -0 yamllint"
|
||||||
|
|
||||||
[testenv:pep8]
|
|
||||||
basepython = python3
|
|
||||||
usedevelop = False
|
|
||||||
description =
|
|
||||||
Run style checks.
|
|
||||||
|
|
||||||
|
|
||||||
commands =
|
|
||||||
flake8
|
|
||||||
|
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
# E123, E125 skipped as they are invalid PEP-8.
|
# E123, E125 skipped as they are invalid PEP-8.
|
||||||
# E501 skipped because some of the code files include templates
|
# E501 skipped because some of the code files include templates
|
||||||
@ -46,10 +39,20 @@ commands =
|
|||||||
show-source = True
|
show-source = True
|
||||||
ignore = E123,E125,E501,H405
|
ignore = E123,E125,E501,H405
|
||||||
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
|
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
|
||||||
|
import-order-style = google
|
||||||
|
|
||||||
|
|
||||||
|
[testenv:pep8]
|
||||||
|
usedevelop = False
|
||||||
|
description =
|
||||||
|
Run style checks.
|
||||||
|
|
||||||
|
|
||||||
|
commands =
|
||||||
|
flake8
|
||||||
|
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
basepython = python3
|
|
||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
@ -71,8 +74,8 @@ whitelist_externals =
|
|||||||
reno
|
reno
|
||||||
|
|
||||||
[testenv:newnote]
|
[testenv:newnote]
|
||||||
basepython = python3
|
|
||||||
# Re-use the releasenotes venv
|
# Re-use the releasenotes venv
|
||||||
|
basepython = python3
|
||||||
envdir = {toxworkdir}/releasenotes
|
envdir = {toxworkdir}/releasenotes
|
||||||
deps = -r{toxinidir}/doc/requirements.txt
|
deps = -r{toxinidir}/doc/requirements.txt
|
||||||
commands = reno new {posargs}
|
commands = reno new {posargs}
|
||||||
|
Loading…
Reference in New Issue
Block a user