Found by aislop scan v0.12.0 on upstream/main (clean checkout).
- Rule ID:
ai-slop/python-isinstance-ladder
- aislop description: Long isinstance ladder is brittle polymorphism.
- Triage: MEDIUM
Affected files
custom_components/keymaster/coordinator.py:458 — 4 repeated isinstance(field_value, ...) branches.
custom_components/keymaster/providers/zigbee2mqtt.py:341 — 4 repeated isinstance(res, ...) branches.
Why this is non-trivial
Both locations are single-file refactors, but they process persisted/coordinator data and provider query results, so mechanical rewrites could alter edge-case behavior.
Suggested starting point
Consider small helper functions or handler maps with existing test coverage for dataclass export and Zigbee2MQTT query result handling.
Found by
aislop scan v0.12.0onupstream/main(clean checkout).ai-slop/python-isinstance-ladderAffected files
custom_components/keymaster/coordinator.py:458— 4 repeatedisinstance(field_value, ...)branches.custom_components/keymaster/providers/zigbee2mqtt.py:341— 4 repeatedisinstance(res, ...)branches.Why this is non-trivial
Both locations are single-file refactors, but they process persisted/coordinator data and provider query results, so mechanical rewrites could alter edge-case behavior.
Suggested starting point
Consider small helper functions or handler maps with existing test coverage for dataclass export and Zigbee2MQTT query result handling.