Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,28 @@ jobs:
run: poetry install --extras cli --no-interaction
- name: 🚀 Run zizmor
run: poetry run zizmor .github/workflows/

vulture:
name: vulture
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "poetry"
- name: 🏗 Install workflow dependencies
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: 🏗 Install Python dependencies
run: poetry install --extras cli --no-interaction
- name: 🚀 Run vulture
run: poetry run vulture
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ repos:
exclude: ^tests/(?:.*/)?__snapshots__/
entry: poetry run trailing-whitespace-fixer
stages: [commit, push, manual]
- id: vulture
name: 🦅 Hunt for dead code with vulture
language: system
types: [python]
entry: poetry run vulture
pass_filenames: false
always_run: true
- id: yamllint
name: 🎗 Check YAML files with yamllint
language: system
Expand Down
18 changes: 15 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ safety = "3.7.0"
syrupy = "5.1.0"
ty = "0.0.31"
typer = "0.24.1"
vulture = "2.16"
yamllint = "1.38.0"
zizmor = "1.24.1"

Expand Down Expand Up @@ -145,6 +146,10 @@ max-complexity = 25
[tool.codespell]
ignore-words-list = "abl"

[tool.vulture]
paths = ["src/wled", "tests"]
min_confidence = 80

[build-system]
requires = ["poetry-core>=2.0"]
build-backend = "poetry.core.masonry.api"
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ class CustomDataclassPlugin(AmberDataSerializerPlugin):
"""Syrupy plugin that serializes dataclass instances recursively in Amber format."""

@classmethod
def is_data_serializable(cls, data: "SerializableData") -> bool:
def is_data_serializable(cls, data: SerializableData) -> bool:
"""Return True for dataclass instances (excludes dataclass types themselves)."""
return dataclasses.is_dataclass(data) and not isinstance(data, type)

@classmethod
def serialize(cls, data: "SerializableData", **kwargs: Any) -> str:
def serialize(cls, data: SerializableData, **kwargs: Any) -> str:
"""Serialize a dataclass instance into Amber format."""
keys = sorted(f.name for f in dataclasses.fields(data))
return CustomDataclassSerializer.serialize_custom_iterable(
Expand Down
Loading