From 533a9f54bc16393e7aade7bb4e9d1044367cd5e4 Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Sat, 3 Dec 2022 13:41:31 -0700 Subject: [PATCH 1/4] ci/install-vm.py: Shorten description to avoid flake8 warning ci/install-vm.py:13:21: E251 unexpected spaces around keyword / parameter equals Signed-off-by: Nathan Chancellor --- ci/install-vm.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/install-vm.py b/ci/install-vm.py index 60bbca9..70ea685 100755 --- a/ci/install-vm.py +++ b/ci/install-vm.py @@ -10,8 +10,7 @@ def parse_parameters(): parser = argparse.ArgumentParser( - description= - "Install a Fedora virtual machine using libvirt and virt-install.", + description="Install a Fedora virtual machine using virt-install.", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument("-c", From 4784e520a97497b5de1cb23775dd9af7b7a80ae5 Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Sat, 3 Dec 2022 13:44:53 -0700 Subject: [PATCH 2/4] ci/install-vm.py: Switch to f-strings As recommended by pylint: ci/install-vm.py:44:16: C0209: Formatting a regular string which could be a f-string (consider-using-f-string) ci/install-vm.py:65:27: C0209: Formatting a regular string which could be a f-string (consider-using-f-string) ci/install-vm.py:72:31: C0209: Formatting a regular string which could be a f-string (consider-using-f-string) ci/install-vm.py:77:8: C0209: Formatting a regular string which could be a f-string (consider-using-f-string) Signed-off-by: Nathan Chancellor --- ci/install-vm.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ci/install-vm.py b/ci/install-vm.py index 70ea685..0a099d7 100755 --- a/ci/install-vm.py +++ b/ci/install-vm.py @@ -41,8 +41,7 @@ def check_requirements(): for command in ["virsh", "virt-install"]: if not shutil.which(command): raise RuntimeError( - "{} could not be found! Install and set up libvirt?".format( - command)) + f"{command} could not be found! Install and set up libvirt?") if not Path("/dev/kvm").exists(): raise RuntimeError( @@ -62,20 +61,19 @@ def main(): cpu = "host" console = "console=ttyS0" else: - raise RuntimeError("This script does not support {}".format(host_arch)) + raise RuntimeError(f"This script does not support {host_arch}") virt_install = ["virt-install"] virt_install += ["--boot", "uefi"] virt_install += ["--connect", "qemu:///system"] virt_install += ["--console", "pty,target_type=serial"] virt_install += ["--cpu", cpu] - virt_install += ["--disk", "size={},format=qcow2".format(args.size)] + virt_install += ["--disk", f"size{args.size},format=qcow2"] virt_install += ["--extra-args", console] virt_install += ["--graphics", "none"] virt_install += [ "--location", - "https://download.fedoraproject.org/pub/fedora/linux/releases/36/Server/{}/os" - .format(host_arch) + f"https://download.fedoraproject.org/pub/fedora/linux/releases/36/Server/{host_arch}/os" ] # libvirt expects MiB; str cast here and '--vcpus' is to avoid: # TypeError: expected str, bytes or os.PathLike object, not int From 6533047c36b6fbc88d38528fbd1b983e25ec9e0f Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Sat, 3 Dec 2022 13:47:23 -0700 Subject: [PATCH 3/4] ci/install-vm.py: Disable pylint warning around invalid module name This is a script, not a module. ci/install-vm.py:1:0: C0103: Module name "install-vm" doesn't conform to snake_case naming style (invalid-name) Signed-off-by: Nathan Chancellor --- ci/install-vm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/install-vm.py b/ci/install-vm.py index 0a099d7..345d9e9 100755 --- a/ci/install-vm.py +++ b/ci/install-vm.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python3 # pylint: disable=invalid-name import argparse import os From 9a511dd1ad89e71179566873c8180b6898a1bda0 Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Wed, 7 Dec 2022 13:30:28 -0700 Subject: [PATCH 4/4] github workflows: Switch to more robust Python linting workflow Signed-off-by: Nathan Chancellor --- .github/workflows/lint.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 32a49ba..9225f2b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,14 +1,20 @@ # Runs several checks # * shellcheck for shell script correctness # * shfmt for shell script formatting consistency -# * yapf for Python formatting consistency +# * several linters for Python consistency and correctness name: Lint checks on: [push, pull_request] jobs: + python: + strategy: + fail-fast: false + matrix: + version: ['3.11', '3.10', '3.9', '3.8'] + uses: ClangBuiltLinux/actions-workflows/.github/workflows/python_lint.yml@main + with: + python_version: ${{ matrix.version }} shellcheck: uses: ClangBuiltLinux/actions-workflows/.github/workflows/shellcheck.yml@main shfmt: uses: ClangBuiltLinux/actions-workflows/.github/workflows/shfmt.yml@main - yapf: - uses: ClangBuiltLinux/actions-workflows/.github/workflows/yapf.yml@main