Commit Graph
61 Commits
Author SHA1 Message Date
Jan-Philipp Benecke 7b9ea63f17 Split out yaml loading into own package (#140683)
* Split out yaml loading into library

* Code review

* Code review

* Fix check config script
2025-03-15 22:26:18 -04:00
epenet a05ac6255c Standardize util imports (#136723) 2025-01-28 15:54:06 +01:00
Joost Lekkerkerker 8a35261fd8 Remove unused noqas (#135583) 2025-01-15 10:02:18 +01:00
Erik Montnemery 3e62c6ae2f Move core config functionality to its own module (#129065)
* Move core config functionality to its own module

* Adjust test
2024-10-24 13:34:51 +02:00
Erik Montnemery 533442f33e Add async friendly helper for validating config schemas (#123800)
* Add async friendly helper for validating config schemas

* Improve docstrings

* Add tests
2024-08-17 11:01:49 +02:00
epenet 07c7bb8b2a Use HOMEASSISTANT_DOMAIN alias for core DOMAIN (#122760) 2024-07-29 13:35:36 +02:00
Sid 2cc916db6d Replace pylint broad-except with Ruff BLE001 (#116250) 2024-05-07 14:00:27 +02:00
J. Nick Koston 5856bbc07b Add missing platforms_exist guard to check_config (#114600)
* Add missing platforms_exist guard to check_config

related issue #112811

When the exception hits, the config will end up being saved in the traceback
so the memory is never released.

This matches the check_config code to homeassistant.config to avoid having
the exception thrown.

* patch

* merge branch
2024-04-01 21:37:30 -04:00
Jan Bouwhuis a4f52cc622 Use a constant to reference homeassistant domain (#113889)
* Use CONF_CORE to reference `homeassistant` domain

* Just use DOMAIN

* USE DOMAIN for `homeasistant` domain in config_schema.py

* Use DOMAIN_HA as constant for homeassistant domain

* Rename CONF_CORE to DOMAIN_HA

* Rename DOMAIN_HA to HA_DOMAIN

* Use relative import

* Use direct imports
2024-03-23 19:58:39 +01:00
J. Nick Koston 3f72fae60b Migrate remaining call in check_config helper to use async_get_component (#113123) 2024-03-11 15:56:24 -10:00
Marc Mueller 19ab3d6daf Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
J. Nick Koston 8fe80a4766 Migrate remaining get_platform in check_config to async_get_platform (#112470)
These were very likely to be cached so they were low on the
list to migrate, but since they are called in the event loop
its best to be sure we do no blocking I/O
2024-03-05 23:47:41 -05:00
chammpandErik Montnemery a5cc0ae890 Improve package schema validation (#108125)
* Add failing tests for package config validation error wrapping

* Wrap package schema validation errors in HomeAssistantError

* Fix yamllint errors

* Rework package merge validation

Ignore invalid package definitions instead of failing startup.
Output error messages with locations if possible when a package
definition has errors.

* Ruff format

* Fix linter errors

* Move package_definition_schema to module scope

* Move inner function to module level

* Merge exception handlers

Merge exception handlers for config schema validation and package merge
to avoid untested code branches

* Fix long lines and doc strings

* More minor changes to exception handler

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-02-10 20:16:20 +01:00
Erik Montnemery 3bcc6194ef Add domain key config validation (#104242)
* Drop use of regex in helpers.extract_domain_configs

* Update test

* Revert test update

* Add domain_from_config_key helper

* Add validator

* Address review comment

* Update snapshots

* Inline domain_from_config_key in validator
2023-12-05 15:07:32 +01:00
Erik Montnemery 25bea91683 Use modern platform path when reporting platform config errors (#104238)
* Use modern platform path when reporting platform config errors

* Update tests

* Address review comment

* Explicitly pass platform domain to log helpers

* Revert overly complicated changes

* Try a simpler solution
2023-12-05 15:06:13 +01:00
Erik Montnemery afea9f7739 Don't mutate config in the check_config helper (#104241) 2023-11-20 12:55:27 +01:00
Erik Montnemery a78764f000 Improve formatting of package errors (#104078) 2023-11-17 14:57:37 +01:00
Erik Montnemery b400b33b0d Refer to domain configuration in custom validator errors (#104065) 2023-11-16 15:28:48 +01:00
Erik Montnemery d8a49b14e5 Use relative paths in configuration validation error messages (#104064) 2023-11-16 10:56:47 +01:00
Erik Montnemery 98030a9ce1 Improve formatting of package errors (#103976) 2023-11-16 09:08:47 +01:00
Erik Montnemery 1c817cc18c Attach relevant config to check_config errors (#104048) 2023-11-16 07:25:52 +01:00
Erik Montnemery 5b37096b5f Refactor config.async_log_exception (#104034)
* Refactor config.async_log_exception

* Improve test coverage

* Make functions public
2023-11-15 19:09:49 +01:00
Erik Montnemery 51b599e1f6 Deduplicate some code in helpers.check_config.async_check_ha_config_file (#103852)
Tweak helpers.check_config.async_check_ha_config_file
2023-11-12 19:15:01 +01:00
Erik Montnemery 123f14dd6c Attach correct platform config in check_config warnings and errors (#103633) 2023-11-09 00:06:04 +01:00
Erik Montnemery cc5eda76d3 Humanize core config errors in check_config helper (#103635) 2023-11-08 10:15:27 +01:00
Erik Montnemery 3ba8a82243 Differentiate between warnings and errors in check_config helper (#102902)
* Differentiate between warnings and errors in check_config helper

* Update tests

* Treat configuration errors in frontend and its dependencies as errors

* Improve test coverage

* Address review comments

* Improve test coverage

* Improve test coverage

* Address review comments

* Add comment
2023-11-05 03:08:04 +01:00
Erik Montnemery a7183a0cbf Allow missing components in safe mode (#102891) 2023-10-27 13:26:26 +02:00
Erik Montnemery 294f565bad Allow missing components in safe mode (#102888) 2023-10-27 12:25:27 +02:00
Erik Montnemery c481fdb7d0 Rename safe mode to recovery mode (#102580) 2023-10-23 20:33:08 +02:00
Erik Montnemery 91faa53843 Don't allow hass.config.config_dir to be None (#98442) 2023-08-16 13:00:14 +02:00
Marc Mueller 77f38e33e5 Import names from typing instead of typing_extensions [3.11] (#97065) 2023-07-22 17:03:44 -05:00
Joost LekkerkerkerandErik Montnemery 0ba2531ca4 Fix bug in check_config when an integration is removed by its own validator (#96068)
* Raise if present is False

* Fix feedback

* Update homeassistant/helpers/check_config.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/helpers/check_config.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Fix tests

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-07-20 11:45:44 +02:00
Franck Nijhof 9030ca05b1 Enable Ruff SIM118 (#87772) 2023-02-15 12:39:12 +01:00
Marc Mueller ea4e2ab4aa Add Self typing (4) [mypy 1.0] (#87601) 2023-02-06 22:30:22 -06:00
Aarni Koskela 8038485ca4 Use partition instead of split where possible in core (#81806) 2022-11-15 21:45:48 +01:00
Marc Mueller 5e633498d2 Enable no_implicit_reexport for core files [mypy] (#63820) 2022-01-26 10:55:06 +01:00
Tobias SauerweinandMarc Mueller 2c904c0974 Bump mypy to 0.930 (#62642)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2021-12-27 17:55:17 +01:00
Ruslan Sayfutdinov 55f4962c06 Fix pylint plugin which checks relative imports (#62693) 2021-12-23 11:14:47 -08:00
J. Nick KostonandPaulus Schoutsen f268227d64 Implement retry and backoff strategy for requirements install (#56580)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-09-26 14:47:03 -05:00
J. Nick KostonandJoakim Sørensen eb98ac9415 Allow IntegrationNotFound when checking config in safe mode (#56283)
Co-authored-by: Joakim Sørensen <hi@ludeeus.dev>
2021-09-17 22:25:50 -07:00
J. Nick KostonandFranck Nijhof 3fa8ffa731 Enable mccabe complexity checks in flake8 (#49616)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-04-25 12:38:40 +02:00
Marc Mueller 6fb2e63e49 Update typing 02 (#48014) 2021-03-17 18:34:19 +01:00
Paulus Schoutsen 2df644c6cc Clean up secret loading (#47034) 2021-03-02 12:58:53 -08:00
Franck Nijhof 9b7c39d20b Postponed evaluation of annotations in core (#46434)
* Postponed evaluation of annotations in core

* Remove unneeded future
2021-02-12 10:58:20 +01:00
Ville Skyttä 67eebce55a Better general/fallback error message and traceback for unknown config errors (#44655)
* Include error repr in config error message is str(error) yields nothing

* Log traceback for config errors we don't have a "friendly" formatter for
2021-01-05 13:55:38 +01:00
Paulus Schoutsen e1de36fda8 Fix check config (#43663) 2020-11-26 22:25:21 +01:00
Paulus Schoutsen 390668e192 Check config to use config platforms (#43407) 2020-11-19 22:05:36 +01:00
Ville Skyttä ac0dbb17af Attrs cleanups (#37849) 2020-07-14 10:30:30 -07:00
Franck NijhofandDaniel Høyer Iversen 7d3c974747 Use set & dict literals (#33636)
Co-authored-by: Daniel Høyer Iversen <mail@dahoiv.net>
2020-04-04 20:05:15 +02:00
Paulus Schoutsen 5fdc60e067 Add Safe Mode (#30723)
* Store last working HTTP settings

* Add safe mode

* Fix tests

* Add cloud to safe mode

* Update logging text

* Fix camera tests leaving files behind

* Make emulated_hue tests not leave files behind

* Make logbook tests not leave files behind

* Make tts tests not leave files behind

* Make image_processing tests not leave files behind

* Make manual_mqtt tests not leave files behind
2020-01-14 13:03:02 -08:00