aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2022-11-23 10:43:25 +0000
committerDaniel P. Berrangé <berrange@redhat.com>2023-01-17 10:09:40 +0000
commitd24d20fd8ef6189ab4df777ddfdd60bf816e392c (patch)
tree02f0265d93ec2b3d70539b4f8e51c511037dc266
parent17b028b6a2c77684d57991f36becf3384a84eece (diff)
downloadlibvirt-ci-d24d20fd8ef6189ab4df777ddfdd60bf816e392c.zip
libvirt-ci-d24d20fd8ef6189ab4df777ddfdd60bf816e392c.tar.gz
libvirt-ci-d24d20fd8ef6189ab4df777ddfdd60bf816e392c.tar.bz2
manifest: integrate support for 'flake8' formatting job
This allows the manifest to request use of 'flake8' for python code formatting checks. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-rw-r--r--examples/manifest.yml1
-rw-r--r--lcitool/gitlab.py11
-rw-r--r--lcitool/manifest.py3
-rw-r--r--tests/data/manifest/in/manifest.yml1
-rw-r--r--tests/data/manifest/out/ci/gitlab/sanity-checks.yml7
5 files changed, 23 insertions, 0 deletions
diff --git a/examples/manifest.yml b/examples/manifest.yml
index e3144bd..9b53447 100644
--- a/examples/manifest.yml
+++ b/examples/manifest.yml
@@ -47,6 +47,7 @@ gitlab:
# go-fmt: false
# clang-format: false
# black: false
+# flake8: false
#
# templates:
# native-build: .native_build_job
diff --git a/lcitool/gitlab.py b/lcitool/gitlab.py
index a9a3377..ccc0b54 100644
--- a/lcitool/gitlab.py
+++ b/lcitool/gitlab.py
@@ -462,6 +462,17 @@ def black_job():
""")
+def flake8_job():
+ return textwrap.dedent(
+ """
+ flake8:
+ extends: .code_format
+ variables:
+ NAME: flake8
+ EXT: txt
+ """)
+
+
def _container_job(target, arch, image, allow_failure, optional):
allow_failure = str(allow_failure).lower()
jobvars = {
diff --git a/lcitool/manifest.py b/lcitool/manifest.py
index a41deeb..0df6f20 100644
--- a/lcitool/manifest.py
+++ b/lcitool/manifest.py
@@ -82,6 +82,7 @@ class Manifest:
jobinfo.setdefault("go-fmt", False)
jobinfo.setdefault("clang-format", False)
jobinfo.setdefault("black", False)
+ jobinfo.setdefault("flake8", False)
templateinfo = gitlabinfo["templates"]
templateinfo.setdefault("native-build", ".native_build_job")
@@ -323,6 +324,8 @@ class Manifest:
fmtcontent.append(gitlab.clang_format_job())
if jobinfo["black"]:
fmtcontent.append(gitlab.black_job())
+ if jobinfo["flake8"]:
+ fmtcontent.append(gitlab.flake8_job())
testcontent = []
if jobinfo["check-dco"]:
diff --git a/tests/data/manifest/in/manifest.yml b/tests/data/manifest/in/manifest.yml
index e05ae9a..0af170a 100644
--- a/tests/data/manifest/in/manifest.yml
+++ b/tests/data/manifest/in/manifest.yml
@@ -11,6 +11,7 @@ gitlab:
clang-format: true
go-fmt: true
black: true
+ flake8: true
targets:
centos-stream-9: x86_64
diff --git a/tests/data/manifest/out/ci/gitlab/sanity-checks.yml b/tests/data/manifest/out/ci/gitlab/sanity-checks.yml
index 498957e..00edbce 100644
--- a/tests/data/manifest/out/ci/gitlab/sanity-checks.yml
+++ b/tests/data/manifest/out/ci/gitlab/sanity-checks.yml
@@ -71,3 +71,10 @@ black:
variables:
NAME: black
EXT: txt
+
+
+flake8:
+ extends: .code_format
+ variables:
+ NAME: flake8
+ EXT: txt