From a5fd5c9c59f8a7e588d114f366f99058fb4ebe34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Mon, 10 Jun 2024 10:50:36 +0000 Subject: [PATCH 1/5] Enable pre-commit black --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ff4759d7..89ce7e37 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,10 +15,10 @@ repos: # - id: editorconfig-checker # exclude: '^LICENSE\.txt$' - # - repo: https://github.com/psf/black - # rev: "24.4.2" - # hooks: - # - id: black + - repo: https://github.com/psf/black + rev: "24.4.2" + hooks: + - id: black # - repo: https://github.com/pycqa/flake8 # rev: 7.0.0 From 0c7213fcf84539e0f4219724cf9f746d19305fb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Mon, 10 Jun 2024 10:51:02 +0000 Subject: [PATCH 2/5] Update pre-commit-hooks --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 89ce7e37..5a49c9d0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 + rev: v4.6.0 hooks: - id: trailing-whitespace - id: check-yaml From 2b96cfbbe6386be7a5871e17f901e6ce6899ff24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Mon, 10 Jun 2024 10:51:37 +0000 Subject: [PATCH 3/5] Add CI action for checking black --- .github/workflows/test.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c8044309..5f346700 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -64,3 +64,9 @@ jobs: flake8.output test.xml coverage.xml + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: psf/black@stable From 6b88f70a845a539be019242e60fcf057ce77fd8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Mon, 10 Jun 2024 10:58:20 +0000 Subject: [PATCH 4/5] Add black formatter to devcontainer --- .devcontainer/Python 3.11/devcontainer.json | 3 ++- .vscode/extensions.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Python 3.11/devcontainer.json b/.devcontainer/Python 3.11/devcontainer.json index 154e481d..a09f809f 100644 --- a/.devcontainer/Python 3.11/devcontainer.json +++ b/.devcontainer/Python 3.11/devcontainer.json @@ -23,7 +23,8 @@ "GitHub.vscode-pull-request-github", "hbenl.vscode-test-explorer", "redhat.vscode-xml", - "ninoseki.vscode-pylens" + "ninoseki.vscode-pylens", + "ms-python.black-formatter" ] } } diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 894e9d73..5cd503c3 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,5 +1,6 @@ { "recommendations": [ - "ms-vscode-remote.remote-containers" + "ms-vscode-remote.remote-containers", + "ms-python.black-formatter" ] } From 247571ee69556f16080d4f27ee9eab87987eea54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Mon, 10 Jun 2024 10:59:02 +0000 Subject: [PATCH 5/5] Add pre-commit to dev requirements --- requirements-dev.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements-dev.txt b/requirements-dev.txt index 9d9e27c2..889770b2 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -12,6 +12,7 @@ Kodistubs ~=21.0 git+https://github.com/romanvm/kodi.six git+https://github.com/ruuk/script.module.addon.signals +pre-commit >= 3.7.1 pytest >= 4.6.11 coverage >= 5.2 flake8 >= 3.8