From d24d20fd8ef6189ab4df777ddfdd60bf816e392c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 23 Nov 2022 10:43:25 +0000 Subject: manifest: integrate support for 'flake8' formatting job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows the manifest to request use of 'flake8' for python code formatting checks. Signed-off-by: Daniel P. Berrangé --- examples/manifest.yml | 1 + lcitool/gitlab.py | 11 +++++++++++ lcitool/manifest.py | 3 +++ tests/data/manifest/in/manifest.yml | 1 + tests/data/manifest/out/ci/gitlab/sanity-checks.yml | 7 +++++++ 5 files changed, 23 insertions(+) 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 -- cgit v1.1