From c6b7308c68e49ca0f004500d77bc00594a6c740b Mon Sep 17 00:00:00 2001 From: Michael Kelly Date: Fri, 24 Feb 2023 20:52:12 -0800 Subject: [PATCH] Convert linters from tox to nox This expands the noxfile to include the linters session and switches the tox-linters job with the nox-linters job. Change-Id: If5ff34aded40c66667eaa468baea10fb2658e2b3 --- .zuul.yaml | 4 ++-- noxfile.py | 7 +++++++ setup.cfg | 10 ++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index 5941f54..88166eb 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -97,14 +97,14 @@ - project: check: jobs: - - tox-linters + - nox-linters - zuul-nox-docs - zuul-operator-build-image - zuul-operator-functional-k8s: dependencies: zuul-operator-build-image gate: jobs: - - tox-linters + - nox-linters - zuul-nox-docs - zuul-operator-upload-image - zuul-operator-functional-k8s: diff --git a/noxfile.py b/noxfile.py index d8be906..4ce4440 100644 --- a/noxfile.py +++ b/noxfile.py @@ -45,3 +45,10 @@ def docs(session): session.install('-e', '.') session.run('sphinx-build', '-E', '-W', '-d', 'doc/build/doctrees', '-b', 'html', 'doc/source/', 'doc/build/html') + + +@nox.session(python='3') +def linters(session): + set_standard_env_vars(session) + session.install('flake8') + session.run('flake8') diff --git a/setup.cfg b/setup.cfg index 7b6711d..e53cea3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -58,3 +58,13 @@ source-dir = doc/source build-dir = doc/build all_files = 1 warning-is-error = 1 + +[flake8] +# These are ignored intentionally in openstack-infra projects; +# please don't submit patches that solely correct them or enable them. +ignore = E124,E125,E129,E252,E402,E741,H,W503,W504 +show-source = True +exclude = .venv,.nox,.tox,dist,doc,build,*.egg +per-file-ignores = + # Allow import * to create a superset of objects + zuul_operator/objects.py:F403,F405