From bb662997f9d1ab12b7ca3a4143971918a16d8c0b Mon Sep 17 00:00:00 2001 From: Harvey Lelliott <42912136+flip-dots@users.noreply.github.com> Date: Wed, 18 Mar 2026 11:11:21 +0000 Subject: [PATCH 1/6] Configure ruff --- .vscode/settings.json | 1 + ruff.toml | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 ruff.toml diff --git a/.vscode/settings.json b/.vscode/settings.json index fa26b6b..2a1660d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,6 +12,7 @@ "source.organizeImports": "explicit" }, }, + "ruff.lint.enable": true, "isort.args": [ "--profile", "black" diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..fde8228 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,7 @@ + +[lint] +select = ["ALL"] +ignore = ["D202", "D212", "D213", "G004", "FURB171"] + +[per-file-ignores] +"tests/*" = ["S101"] From b75637537008bd0556fe1bce1ec1e2ada5612362 Mon Sep 17 00:00:00 2001 From: Harvey Lelliott <42912136+flip-dots@users.noreply.github.com> Date: Wed, 18 Mar 2026 11:11:59 +0000 Subject: [PATCH 2/6] Add ruff and mypy --- .vscode/extensions.json | 4 +++- requirements_dev.txt | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 656788f..da8e3dd 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,8 @@ { "recommendations": [ "ms-python.isort", - "ms-python.black-formatter" + "ms-python.black-formatter", + "charliermarsh.ruff", + "ms-python.mypy-type-checker" ] } \ No newline at end of file diff --git a/requirements_dev.txt b/requirements_dev.txt index 8c45f05..0198e36 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -4,4 +4,6 @@ pytest-homeassistant-custom-component pyserial pytest-cov aiousbwatcher +ruff +mypy SolixBLE==3.4.0 \ No newline at end of file From a3a0ff82120d2f5c61a5676cd0a105099389799d Mon Sep 17 00:00:00 2001 From: Harvey Lelliott <42912136+flip-dots@users.noreply.github.com> Date: Wed, 18 Mar 2026 11:12:16 +0000 Subject: [PATCH 3/6] Add workflow for mypy --- .github/workflows/mypy.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/mypy.yml diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml new file mode 100644 index 0000000..63774b0 --- /dev/null +++ b/.github/workflows/mypy.yml @@ -0,0 +1,28 @@ +name: Type check + +on: [push] + +jobs: + mypy: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.13"] + + steps: + - uses: actions/checkout@v5 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements_dev.txt + - name: Install library + run: | + python -m pip install . + - name: Run mypy + run: | + mypy custom_components tests --strict --namespace-packages --explicit-package-bases From 6a23bbab215b9ba08254c89efb8965e7ac0856ba Mon Sep 17 00:00:00 2001 From: Harvey Lelliott <42912136+flip-dots@users.noreply.github.com> Date: Wed, 18 Mar 2026 11:12:22 +0000 Subject: [PATCH 4/6] Add workflow for ruff --- .github/workflows/ruff.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/workflows/ruff.yml diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 0000000..0d1e50c --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,8 @@ +name: Ruff +on: [ push, pull_request ] +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/ruff-action@v3 \ No newline at end of file From b4c43156c05f59aedaa3c337eae45c6c0c6eab6a Mon Sep 17 00:00:00 2001 From: Harvey Lelliott <42912136+flip-dots@users.noreply.github.com> Date: Wed, 18 Mar 2026 11:16:13 +0000 Subject: [PATCH 5/6] Ignore private member access in test files --- ruff.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruff.toml b/ruff.toml index fde8228..0b87165 100644 --- a/ruff.toml +++ b/ruff.toml @@ -4,4 +4,4 @@ select = ["ALL"] ignore = ["D202", "D212", "D213", "G004", "FURB171"] [per-file-ignores] -"tests/*" = ["S101"] +"tests/*" = ["S101", "SLF001"] From f03ecb6449eae81e19aaeabbe6628bed7f9161fe Mon Sep 17 00:00:00 2001 From: Harvey Lelliott <42912136+flip-dots@users.noreply.github.com> Date: Wed, 18 Mar 2026 11:16:46 +0000 Subject: [PATCH 6/6] Fix issue running mypy in workflow --- .github/workflows/mypy.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 63774b0..d6e6a30 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -20,9 +20,6 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements_dev.txt - - name: Install library - run: | - python -m pip install . - name: Run mypy run: | mypy custom_components tests --strict --namespace-packages --explicit-package-bases