From 63db49f6b61d9ef966843d97189afdbd264ae572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Piliszek?= Date: Thu, 25 May 2023 17:08:39 +0200 Subject: [PATCH] [CI] Add nox linting Change-Id: I2a9145031e41fe3d591a89dc2a67dcbcd02ba722 --- .gitignore | 2 ++ .yamllint | 4 ++++ noxfile.py | 36 ++++++++++++++++++++++++++++++++++++ zuul.d/project.yaml | 2 ++ 4 files changed, 44 insertions(+) create mode 100644 .yamllint create mode 100644 noxfile.py diff --git a/.gitignore b/.gitignore index e69de29..e0e9b8b 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,2 @@ +__pycache__/ +.nox/ diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..2f00cb6 --- /dev/null +++ b/.yamllint @@ -0,0 +1,4 @@ +extends: default +rules: + document-start: disable + line-length: disable diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 0000000..04fe980 --- /dev/null +++ b/noxfile.py @@ -0,0 +1,36 @@ +import nox + +nox.options.error_on_external_run = True +nox.options.reuse_existing_virtualenvs = True + +YAML_PATHS = [ + "./zuul.d/", +] + +PYTHON_PATHS = [ + "./noxfile.py", +] + + +@nox.session +def black(session): + session.install("black") + session.run("black", *PYTHON_PATHS) + + +@nox.session +def isort(session): + session.install("isort") + session.run("isort", "--profile=black", *PYTHON_PATHS) + + +@nox.session +def linters(session): + session.install("yamllint") + session.install("black") + session.install("isort") + session.install("flake8") + session.run("yamllint", *YAML_PATHS) + session.run("black", "--check", *PYTHON_PATHS) + session.run("isort", "--profile=black", "--check", *PYTHON_PATHS) + session.run("flake8", *PYTHON_PATHS) diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index 3c7cd10..e5fd367 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -2,9 +2,11 @@ check: jobs: - nebulous-component-template-build-container-images + - nox-linters gate: jobs: - nebulous-component-template-upload-container-images + - nox-linters promote: jobs: - nebulous-component-template-promote-container-images