Rest refactor - #6
Merged
Merged
Conversation
- BLE001: narrow the catches with known failure modes (dict_get -> KeyError/IndexError/TypeError; device-tracker icon -> KeyError/TypeError) and mark the deliberate catch-all fallbacks (cache read/write, poll -> cache, device-tracker -> last state, OUI lookup, best-effort state kill) with `# noqa: BLE001` and a reason. - S110: replace the two bare `except: pass` in the MAC-vendor path with a debug log. - RUF046: drop the redundant `int()` around `round(...)` (no-ndigits round already returns int) in the rate math. - RUF013: `service_kill_states` destination -> `str | None`. - RUF012: annotate `Client._RULE_REQUIRED_DEFAULTS` as `ClassVar`. - SIM118: drop `.keys()` from iteration / membership checks in sensor.py, switch.py, update.py. - SIM102: collapse two nested `if`s in sensor.py into single `and` conditions. No behaviour change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Add pyproject.toml mirroring home-assistant/core's [tool.ruff] rule selection so the Code Checker action enforces the same standard, and pin ruff in the workflow so a future release can't turn CI red unrelatedly. Rules the HA selection flags that this fork does not satisfy yet (missing docstrings, `property` loop-var shadowing, private-member access, a few try/except shapes) are listed in a clearly marked project-specific ignore block to clear incrementally - new code is still linted against the full set. Applied `ruff check --fix` + `ruff format` (import ordering, redundant `int(round())`, deprecated `typing` imports, string reflows) and a few manual fixes: cache read/write now catch OSError/HomeAssistantError/ ValueError instead of bare Exception, UpdateFailed re-raises use `from err`, cache logging uses `%s` placeholders. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Works through the smaller half of the deferred ruff findings so the project ignore block now only lists docstrings (D1xx), the `property` loop-variable shadowing (A001), private-member access (SLF001), the tests-not-a-package warning (INP001), and PT022. - dict_get (both copies): single try around the loop (PERF203), drop the `pathList` name (N806), add a docstring. - __init__ coordinator update functions: restructure so the success path is an `else` branch and no `raise` sits inside the `try` (TRY300/301); behaviour is unchanged (empty poll and errors both fall back to cache). - pypfsense: contextlib.suppress for the arp-entry / reboot / halt / kill-states swallow-and-continue spots (SIM105/PERF203), dict-update comprehension for the statetype backfill (PERF403). - binary_sensor / button: return the list literal directly (RET504). - sensor: list(SENSOR_TYPES) (C416), `== "connected_client_count"` (FURB171), gateway native_value reads outside the try (TRY300); the two genuinely branchy entity-builder callbacks get `# noqa: C901`. - switch service is_on: return the lookup directly (RET504/TRY300). - services: keep the deferred import, `# noqa: PLC0415` (breaks a cycle). - tests: parametrize names as a tuple (PT006). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Rename the `property` loop/local variables to `prop` across sensor.py, switch.py, device_tracker.py so they stop shadowing the builtin (A001). - PfSenseData grows a `restore_state()` method and the device-tracker coordinator reads `.state`, so the cache-fallback path no longer pokes `_state` directly; the runtime-injected update_alias service takes `self` instead of `self_entity` (SLF001). Tests legitimately touch internals, so `tests/**` ignores SLF001 via per-file-ignores. - Add `tests/__init__.py` so the test files are a real package (INP001). - The `auto_enable_custom_integrations` fixtures `return` instead of `yield` since they have no teardown (PT022). The ignore block is now only the docstring rules. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Documents every public module, class, method and function flagged by the Home Assistant `D` (pydocstyle) rules, plus the two D415 / one D205 wording fixes. Client methods, entity classes and the service handlers get hand-written summaries; entity property accessors and test functions get the conventional one-liners. With that done the project-specific ignore block is removed: pyproject.toml now carries the Home Assistant rule selection verbatim, and `ruff check .` is clean against it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
New user-facing option (reset matching states when a rule switch is toggled) plus the poll-crash / statetype fixes and the full Home Assistant ruff adoption since 0.9.1. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
🎉 Thank you for contributing to SkyRadar Fusion! Your Pull Request has been received. Our automated tests (Hassfest, Ruff, etc.) will run shortly. If anything fails, don't worry—just check the logs and update your branch! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.