[CI] Add nox linting

Change-Id: I2a9145031e41fe3d591a89dc2a67dcbcd02ba722
This commit is contained in:
Radosław Piliszek 2023-05-25 17:08:39 +02:00
parent 2180f468ba
commit 63db49f6b6
4 changed files with 44 additions and 0 deletions

2
.gitignore vendored
View File

@ -0,0 +1,2 @@
__pycache__/
.nox/

4
.yamllint Normal file
View File

@ -0,0 +1,4 @@
extends: default
rules:
document-start: disable
line-length: disable

36
noxfile.py Normal file
View File

@ -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)

View File

@ -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