From 084ef206955a428106c347cc6d60bf3b83a0c080 Mon Sep 17 00:00:00 2001 From: Arie Catsman <120491684+catsmanac@users.noreply.github.com> Date: Tue, 17 Dec 2024 11:33:04 +0100 Subject: [PATCH] Add quality_scale.yaml to enphase_envoy (#132489) --- .../components/enphase_envoy/config_flow.py | 3 +- .../enphase_envoy/quality_scale.yaml | 124 ++++++++++++++++++ script/hassfest/quality_scale.py | 1 - 3 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 homeassistant/components/enphase_envoy/quality_scale.yaml diff --git a/homeassistant/components/enphase_envoy/config_flow.py b/homeassistant/components/enphase_envoy/config_flow.py index 23c769293c8..70ba3570e91 100644 --- a/homeassistant/components/enphase_envoy/config_flow.py +++ b/homeassistant/components/enphase_envoy/config_flow.py @@ -31,6 +31,7 @@ from .const import ( OPTION_DISABLE_KEEP_ALIVE, OPTION_DISABLE_KEEP_ALIVE_DEFAULT_VALUE, ) +from .coordinator import EnphaseConfigEntry _LOGGER = logging.getLogger(__name__) @@ -67,7 +68,7 @@ class EnphaseConfigFlow(ConfigFlow, domain=DOMAIN): @staticmethod @callback def async_get_options_flow( - config_entry: ConfigEntry, + config_entry: EnphaseConfigEntry, ) -> EnvoyOptionsFlowHandler: """Options flow handler for Enphase_Envoy.""" return EnvoyOptionsFlowHandler() diff --git a/homeassistant/components/enphase_envoy/quality_scale.yaml b/homeassistant/components/enphase_envoy/quality_scale.yaml new file mode 100644 index 00000000000..c4077b8df67 --- /dev/null +++ b/homeassistant/components/enphase_envoy/quality_scale.yaml @@ -0,0 +1,124 @@ +rules: + # Bronze + action-setup: + status: done + comment: only actions implemented are platform native ones. + appropriate-polling: + status: done + comment: fixed 1 minute cycle based on Enphase Envoy device characteristics + brands: done + common-modules: + status: done + comment: | + In coordinator.py, you set self.entry = entry, while after the super constructor, + you can access the entry via self.config_entry (you would have to overwrite the + type to make sure you don't have to assert not None every time)done + config-flow-test-coverage: + status: todo + comment: | + - test_form is missing an assertion for the unique id of the resulting entry + - Let's also have test_user_no_serial_number assert the unique_id (as in, it can't be set to the serial_number since we dont have one, so let's assert what it will result in) + - Let's have every test result in either CREATE_ENTRY or ABORT (like test_form_invalid_auth or test_form_cannot_connect, they can be parametrized) + - test_zeroconf_token_firmware and test_zeroconf_pre_token_firmware can also be parametrized I think + - test_zero_conf_malformed_serial_property - with pytest.raises(KeyError) as ex:: + I don't believe this should be able to raise a KeyError Shouldn't we abort the flow? + test_reauth -> Let's also assert result before we start with the async_configure part + config-flow: + status: todo + comment: | + - async_step_zeroconf -> a config entry title is considered userland, + so if someone renamed their entry, it will be reverted back with the code at L146. + - async_step_reaut L160: I believe that the unique is already set when starting a reauth flow + - The config flow is missing data descriptions for the other fields + dependency-transparency: done + docs-actions: + status: done + comment: https://www.home-assistant.io/integrations/enphase_envoy/#actions + docs-high-level-description: + status: done + comment: https://www.home-assistant.io/integrations/enphase_envoy + docs-installation-instructions: + status: done + comment: https://www.home-assistant.io/integrations/enphase_envoy#prerequisites + docs-removal-instructions: + status: done + comment: https://www.home-assistant.io/integrations/enphase_envoy#removing-the-integration + entity-event-setup: + status: done + comment: no events used. + entity-unique-id: done + has-entity-name: done + runtime-data: + status: done + comment: | + async_unload_entry- coordinator: EnphaseUpdateCoordinator = entry.runtime_data + You can remove the EnphaseUpdateCoordinator as the type can now be inferred thanks to the typed config entry + test-before-configure: done + test-before-setup: done + unique-config-entry: done + + # Silver + action-exceptions: + status: todo + comment: | + needs to raise appropriate error when exception occurs. + Pending https://github.com/pyenphase/pyenphase/pull/194 + config-entry-unloading: done + docs-configuration-parameters: + status: done + comment: https://www.home-assistant.io/integrations/enphase_envoy#configuration + docs-installation-parameters: + status: done + comment: https://www.home-assistant.io/integrations/enphase_envoy#required-manual-input + entity-unavailable: done + integration-owner: done + log-when-unavailable: done + parallel-updates: + status: done + comment: pending https://github.com/home-assistant/core/pull/132373 + reauthentication-flow: done + test-coverage: + status: todo + comment: | + - test_config_different_unique_id -> unique_id set to the mock config entry is an int, not a str + - Apart from the coverage, test_option_change_reload does not verify that the config entry is reloaded + + # Gold + devices: done + diagnostics: done + discovery-update-info: done + discovery: done + docs-data-update: + status: done + comment: https://www.home-assistant.io/integrations/enphase_envoy#data-updates + docs-examples: + status: todo + comment: add blue-print examples, if any + docs-known-limitations: todo + docs-supported-devices: + status: done + comment: https://www.home-assistant.io/integrations/enphase_envoy#supported-devices + docs-supported-functions: todo + docs-troubleshooting: + status: done + comment: https://www.home-assistant.io/integrations/enphase_envoy#troubleshooting + docs-use-cases: todo + dynamic-devices: todo + entity-category: todo + entity-device-class: done + entity-disabled-by-default: done + entity-translations: done + exception-translations: + status: todo + comment: pending https://github.com/home-assistant/core/pull/132483 + icon-translations: todo + reconfiguration-flow: done + repair-issues: + status: exempt + comment: no general issues or repair.py + stale-devices: todo + + # Platinum + async-dependency: done + inject-websession: done + strict-typing: done diff --git a/script/hassfest/quality_scale.py b/script/hassfest/quality_scale.py index 5ad3467dd79..83335fa5c44 100644 --- a/script/hassfest/quality_scale.py +++ b/script/hassfest/quality_scale.py @@ -355,7 +355,6 @@ INTEGRATIONS_WITHOUT_QUALITY_SCALE_FILE = [ "energyzero", "enigma2", "enocean", - "enphase_envoy", "entur_public_transport", "environment_canada", "envisalink",