Skip to content

aislop: ai-slop/python-isinstance-ladder in coordinator and zigbee2mqtt #656

Description

@tykeal

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    aislopFindings from aislop scan

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions