Skip to content

aislop: complexity/function-too-long across core flows #654

Description

@tykeal

Found by aislop scan v0.12.0 on upstream/main (clean checkout).

  • Rule ID: complexity/function-too-long
  • aislop description: Function is doing too much in one body.
  • Triage: HARD

Affected files

  • custom_components/keymaster/__init__.py:92 — async_setup_entry · 143 lines
  • custom_components/keymaster/config_flow.py:253 — _get_schema · 111 lines
  • custom_components/keymaster/coordinator.py:900 — _lock_unlocked · 126 lines
  • custom_components/keymaster/coordinator.py:2212 — _sync_pin · 139 lines
  • custom_components/keymaster/lovelace.py:726 — _generate_parent_view_card_ll_config · 115 lines
  • custom_components/keymaster/migrate.py:325 — _migrate_2to3_build_delete_list · 146 lines
  • custom_components/keymaster/providers/schlage.py:258 — async_get_usercodes · 157 lines
  • custom_components/keymaster/providers/zha.py:405 — subscribe_lock_events · 120 lines
  • custom_components/keymaster/providers/zigbee2mqtt.py:123 — async_connect · 143 lines
  • custom_components/keymaster/providers/zwave_js.py:382 — async_connect · 116 lines
  • custom_components/keymaster/providers/zwave_js.py:775 — async_clear_usercode · 110 lines
  • custom_components/keymaster/providers/zwave_js.py:939 — subscribe_lock_events · 159 lines
  • custom_components/keymaster/switch.py:35 — async_setup_entry · 131 lines

Why this is non-trivial

Several functions are setup, migration, provider, Lovelace, or coordinator state-machine flows. The right decomposition is design-sensitive and not an easy mechanical cleanup.

Suggested starting point

Prioritize the highest-risk flows, extract named helpers around existing decision points, and keep public behavior and provider contracts unchanged with targeted tests.

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