Skip to content

Commit f729a5d

Browse files
authored
chore(tooling): improve linting, CI caching, and maintenance automation (#1892)
## Summary Improves code quality tooling and CI efficiency. **Code quality:** - Enable additional ruff rules: ASYNC, S (security), T (print detection), C4 (comprehensions) - Add actionlint pre-commit hook to validate GitHub workflow files **CI efficiency:** - Add UV caching to lint and test workflows - Fix shellcheck warnings in release workflow **Maintenance:** - Change dependabot from daily to weekly updates - Remove unused tox dependency
1 parent 12174b4 commit f729a5d

18 files changed

Lines changed: 56 additions & 64 deletions

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ updates:
33
- package-ecosystem: "uv"
44
directory: "/"
55
schedule:
6-
interval: "daily"
6+
interval: "weekly"
77
time: "08:00"
88
open-pull-requests-limit: 10
99

1010
- package-ecosystem: "github-actions"
1111
directory: "/"
1212
schedule:
13-
interval: "daily"
13+
interval: "weekly"
1414
time: "08:00"
1515
open-pull-requests-limit: 10
1616

.github/workflows/lint.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020

2121
- name: Install uv
2222
uses: astral-sh/setup-uv@v7
23+
with:
24+
enable-cache: true
25+
cache-suffix: ${{ matrix.python-version }}
2326

2427
- name: Set up Python ${{ matrix.python-version }}
2528
uses: actions/setup-python@v6

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ jobs:
3030
- name: Retrieve version from tag name
3131
id: retrieve-version
3232
run: |
33-
tag=${{ github.event.release.tag_name }}
34-
version_number=${tag#?}
35-
echo version: $version_number
36-
echo "version=$version_number" >> $GITHUB_OUTPUT
33+
tag="${{ github.event.release.tag_name }}"
34+
version_number="${tag#?}"
35+
echo "version: $version_number"
36+
echo "version=$version_number" >> "$GITHUB_OUTPUT"
3737
3838
- name: Bump project version in pyproject.toml and commit changes to current branch and tag
3939
run: |

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020

2121
- name: Install uv
2222
uses: astral-sh/setup-uv@v7
23+
with:
24+
enable-cache: true
25+
cache-suffix: ${{ matrix.python-version }}
2326

2427
- name: Set up Python ${{ matrix.python-version }}
2528
uses: actions/setup-python@v6

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ repos:
2222
- id: no-commit-to-branch
2323
stages: [pre-commit]
2424
args: [--branch, main]
25+
- repo: https://github.com/rhysd/actionlint
26+
rev: v1.7.7
27+
hooks:
28+
- id: actionlint
2529
- repo: local
2630
hooks:
2731
- id: mypy

pyoverkiz/const.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
SOMFY_API = "https://accounts.somfy.com"
1919
SOMFY_CLIENT_ID = "0d8e920c-1478-11e7-a377-02dd59bd3041_1ewvaqmclfogo4kcsoo0c8k4kso884owg08sg8c40sk4go4ksg"
20-
SOMFY_CLIENT_SECRET = "12k73w1n540g8o4cokg0cw84cog840k84cwggscwg884004kgk"
20+
# OAuth client secrets are public by design (embedded in mobile apps)
21+
SOMFY_CLIENT_SECRET = "12k73w1n540g8o4cokg0cw84cog840k84cwggscwg884004kgk" # noqa: S105
2122

2223
LOCAL_API_PATH = "/enduser-mobile-web/1/enduserAPI/"
2324

pyoverkiz/enums/command.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
"""Command-related enums and parameters used by device commands."""
22

3+
# ruff: noqa: S105
4+
# Enum values contain "PASS" in API names (e.g. PassAPC), not passwords
5+
36
import sys
47
from enum import unique
58

pyoverkiz/enums/general.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
"""General-purpose enums like product types, data types and event names."""
22

3+
# ruff: noqa: S105
4+
# Enum values contain "TOKEN" in API event names, not passwords
5+
36
import logging
47
import sys
58
from enum import IntEnum, unique

pyoverkiz/enums/state.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
"""State and attribute enums describing Overkiz device states and attributes."""
22

3+
# ruff: noqa: S105
4+
# Enum values contain "PASS" or "TOKEN" in API names, not passwords
5+
36
import sys
47
from enum import unique
58

pyoverkiz/enums/ui.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
"""UI enums for classes and widgets used to interpret device UI metadata."""
22

3+
# ruff: noqa: S105
4+
# Enum values contain "PASS" in API names (e.g. PassAPC), not passwords
5+
36
import logging
47
import sys
58
from enum import unique

0 commit comments

Comments
 (0)