From 1ff33f5afc48a431010a60e4053ea6a59a814708 Mon Sep 17 00:00:00 2001 From: Wil T Date: Sat, 28 Dec 2024 19:28:19 -0500 Subject: [PATCH 1/5] improved linting workflow --- .github/workflows/lint.yml | 59 ++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 639cdc7..31feb97 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,25 +8,42 @@ on: branches: - "master" +permissions: + contents: read + jobs: - ruff: - name: "Ruff" - runs-on: "ubuntu-latest" - steps: - - name: "Checkout the repository" - uses: "actions/checkout@v4.1.7" - - - name: "Set up Python" - uses: actions/setup-python@v5.1.0 - with: - python-version: "3.12" - cache: "pip" - - - name: "Install requirements" - run: python3 -m pip install -r requirements.txt - - - name: "Lint" - run: python3 -m ruff check . - - - name: "Format" - run: python3 -m ruff format . --check + ruff-format: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Set up Python 3.12 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 + with: + python-version: "3.12" + + - name: "Install requirements" + run: python3 -m pip install -r requirements.txt + + - name: Run ruff format + run: | + ruff format --diff --target-version=py312 . + + ruff: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Set up Python 3.12 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 + with: + python-version: "3.12" + + - name: "Install requirements" + run: python3 -m pip install -r requirements.txt + + - name: Run ruff + run: | + ruff check --output-format=github . From 6a57723b3a374ce39a3613db42503a5357135177 Mon Sep 17 00:00:00 2001 From: Wil T Date: Sat, 28 Dec 2024 19:31:12 -0500 Subject: [PATCH 2/5] use pip cache --- .github/workflows/lint.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 31feb97..7f21867 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,7 +22,8 @@ jobs: uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: "3.12" - + cache: "pip" + - name: "Install requirements" run: python3 -m pip install -r requirements.txt @@ -40,6 +41,7 @@ jobs: uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: "3.12" + cache: "pip" - name: "Install requirements" run: python3 -m pip install -r requirements.txt From 96143731e7e07295ea01fe29e268d72c75004201 Mon Sep 17 00:00:00 2001 From: Wil T Date: Sun, 29 Dec 2024 09:59:15 -0500 Subject: [PATCH 3/5] Format const.py --- custom_components/victorsmartkill/const.py | 1 + 1 file changed, 1 insertion(+) diff --git a/custom_components/victorsmartkill/const.py b/custom_components/victorsmartkill/const.py index abaea8b..29d4c9e 100644 --- a/custom_components/victorsmartkill/const.py +++ b/custom_components/victorsmartkill/const.py @@ -1,4 +1,5 @@ """Constants for victorsmartkill.""" + from __future__ import annotations # Base component constants From bbd73b551a4458a2a3a8298a9b49ea3ad186a8bc Mon Sep 17 00:00:00 2001 From: Wil T Date: Sun, 29 Dec 2024 09:59:33 -0500 Subject: [PATCH 4/5] Format entity.py --- custom_components/victorsmartkill/entity.py | 1 + 1 file changed, 1 insertion(+) diff --git a/custom_components/victorsmartkill/entity.py b/custom_components/victorsmartkill/entity.py index 8733619..fe762fb 100644 --- a/custom_components/victorsmartkill/entity.py +++ b/custom_components/victorsmartkill/entity.py @@ -1,4 +1,5 @@ """VictorSmartKillEntity class.""" + from __future__ import annotations from abc import ABC, abstractmethod From 73757db7c60a730ddfafce54a1412c1a37325140 Mon Sep 17 00:00:00 2001 From: Wil T Date: Sun, 29 Dec 2024 09:59:48 -0500 Subject: [PATCH 5/5] Format system_health.py --- custom_components/victorsmartkill/system_health.py | 1 + 1 file changed, 1 insertion(+) diff --git a/custom_components/victorsmartkill/system_health.py b/custom_components/victorsmartkill/system_health.py index 8da6ea8..fb8f41e 100644 --- a/custom_components/victorsmartkill/system_health.py +++ b/custom_components/victorsmartkill/system_health.py @@ -1,4 +1,5 @@ """Provide info to system health.""" + from __future__ import annotations from typing import Any