Commit Graph

262 Commits (b75277cc24a7bb5a522669cf2a896c91cfc567a1)

Author SHA1 Message Date
chammp 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 88dfe8d33b
Remove unused TypeVar from config.py (#108495) 2024-01-20 14:39:12 -05:00
Erik Montnemery 5e79cd8715
Remove file/line annotations after config has been validated (#107139) 2024-01-14 11:07:39 +01:00
Robert Resch 8b08b5e8d2
Deprecate legacy_templates (#105556)
* Deprecate legacy_templates

* Improve wording

* Implement suggestion

* simplify

* Add deleting of the repair issues back

* Update homeassistant/components/homeassistant/strings.json

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Test issue removal too

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-12-22 00:42:16 +01:00
Ville Skyttä 24b1e01d71
Update Ruff to 0.1.8, avoid linter/formatter conflicts (#106080)
* Disable Ruff rules that may conflict with the formatter

* Upgrade Ruff to 0.1.8

- https://github.com/astral-sh/ruff/releases/tag/v0.1.7
- https://github.com/astral-sh/ruff/releases/tag/v0.1.8

* Format with Ruff 0.1.8
2023-12-20 23:55:09 +01:00
Erik Montnemery 5b55c7da5f
Remove logic converting empty or falsy YAML to empty dict (#103912)
* Correct logic converting empty YAML to empty dict

* Modify according to github comments

* Add load_yaml_dict helper

* Update check_config script

* Update tests
2023-12-05 18:08:11 +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 95f7db1970
Move config_per_platform and extract_domain_configs to config.py (#104989) 2023-12-04 12:48:49 +01:00
Jan Bouwhuis 487ff8cd7f
Rename ex to exc as name for exceptions (#104479) 2023-11-25 08:30:18 +01:00
Jan Bouwhuis 9962301b42
Do not notify config errors during logging (#104466) 2023-11-24 21:34:09 +01:00
Jan Bouwhuis af71c2bb45
Raise and suppress stack trace when reloading yaml fails (#102410)
* Allow async_integration_yaml_config to raise

* Docstr - split check

* Implement as wrapper, return dataclass

* Fix setup error handling

* Fix reload test mock

* Move log_messages to error handler

* Remove unreachable code

* Remove config test helper

* Refactor and ensure notifications during setup

* Remove redundat error, adjust tests notifications

* Fix patch

* Apply suggestions from code review

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

* Follow up comments

* Add call_back decorator

* Split long lines

* Update exception abbreviations

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-11-24 17:34:45 +01:00
Erik Montnemery 80813e992d
Improve formatting of component errors (#104081)
* Improve formatting of component errors

* Update tests
2023-11-17 23:01:00 +01:00
Erik Montnemery 23ef97f774
Use relative paths in yaml syntax error messages (#104084) 2023-11-17 23:00:23 +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 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 dd7670cacf
Improve errors for component configuration with missing keys (#103982) 2023-11-15 10:47:05 +01:00
Erik Montnemery e87ebbef01
Improve errors for component configuration with multiple errors (#103969)
* Improve errors for component configuration with multiple errors

* Suffix with link to documentation
2023-11-14 21:50:54 +01:00
Erik Montnemery 2d39eaf0a2
Improve docstring of config.stringify_invalid (#103965) 2023-11-14 14:05:46 +01:00
Erik Montnemery 94a2087ba0
Improve formatting of config validation errors (#103957)
* Improve formatting of config validation errors

* Address review comments
2023-11-14 12:48:45 +01:00
Erik Montnemery dedd3418a1
Improve print of line numbers when there are configuration errors (#103216)
* Improve print of line numbers when there are configuration errors

* Update alarm_control_panel test
2023-11-14 08:21:36 +01:00
Erik Montnemery 07af073735
Remove trailing space from configuration error messages (#103909)
* Remove trailing space from configuration error messages

* Update test
2023-11-13 15:19:37 +01:00
Erik Montnemery 6303366cf4
Tweak config._recursive_merge (#103850) 2023-11-12 19:06:12 +01:00
Erik Montnemery 97cc05d0b4
Make it possible to restart core in safe mode (#102606) 2023-10-24 14:47:58 +02:00
SmashedFrenzy16 3018d4edb9
Update config.py with f string (#101333)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-10-07 13:37:19 +02:00
Erik Montnemery cab30085c5
Fix typo in config.py (#101268) 2023-10-02 15:57:04 +02:00
Ville Skyttä 6399d74c15
Remove unnnecessary pylint configs from core (#98704) 2023-08-22 23:12:12 +02:00
Erik Montnemery 91faa53843
Don't allow hass.config.config_dir to be None (#98442) 2023-08-16 13:00:14 +02:00
Martin Hjelmare 4d2fa5bdbc
Onboard Google Translate (#95352) 2023-06-27 13:12:25 +02:00
c0ffeeca7 c3a3ddcfa4
Standardize spelling of TTS and STT (#93857)
* Standardize spelling of TTS and STT

* Apply suggestions from code review

* Update homeassistant/components/tts/media_source.py

---------

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2023-05-31 11:00:19 -04:00
epenet 611d4135fd
Add ComponentProtocol to improve type checking (#90586) 2023-03-31 14:19:58 -04:00
Franck Nijhof 73c4ac53d2
Enable T20 (flake8-print) to ban use of print statements (#86525)
* Enable T20 (flake8-print) to ban use of print statements

* Make compatible with flake8 config
2023-01-24 14:24:21 +01:00
Franck Nijhof 79b52a2b41
Stricter pylint message control (#86154) 2023-01-20 13:47:55 +01:00
Franck Nijhof 64c2340fab
Core code styling improvements (#85963) 2023-01-15 23:00:51 +01:00
Franck Nijhof b0cee0bc46
String formatting and max line length - Part 1 (#84390)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-12-22 10:12:50 +01:00
Erik Montnemery 67e4f2c202
Raise repairs issue if country is not configured (#82685) 2022-11-28 09:54:13 +01:00
Erik Montnemery e1338adf1a
Allow configuring country and language in core config (#81734)
* Allow configuring country and language in core config

* Add script for updating list of countries

* Use black for formatting

* Fix quoting

* Move country codes to a separate file

* Address review comments

* Add generated/countries.py

* Get default language from owner account

* Remove unused variable

* Add script to generate list of supported languages

* Add tests

* Fix stale docsring

* Use format_python_namespace

* Correct async_user_store

* Improve typing

* Fix with_store decorator

* Initialize language in core store migration

* Fix startup

* Tweak

* Apply suggestions from code review

Co-authored-by: Franck Nijhof <git@frenck.dev>

* Update storage.py

Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-11-24 23:25:50 +01:00
Aarni Koskela 8038485ca4
Use partition instead of split where possible in core (#81806) 2022-11-15 21:45:48 +01:00
Erik Montnemery a2da1c7db5
Create repairs issue if an outdated currency code is configured in core store (#81772)
* Create repairs issue if an outdated currency code is configured in core store

* Update homeassistant/config.py

Co-authored-by: Aarni Koskela <akx@iki.fi>

Co-authored-by: Aarni Koskela <akx@iki.fi>
2022-11-10 17:28:19 +01:00
Erik Montnemery c3d4a9cd99
Create repairs issue if an outdated currency code is configured (#81717)
* Create repairs issue if an outdated currency code is configured

* Add script for updating list of currencies

* Use black for formatting

* Move currency codes to a separate file

* Address review comments
2022-11-08 07:21:09 +01:00
Franck Nijhof 398d18eeee
Load themes from themes folder by default (#80937) 2022-10-25 12:10:40 +02:00
epenet bff5d1123f
Deprecate CONF_UNIT_SYSTEM_*** constants (#80320)
* Deprecate CONF_UNIT_SYSTEM_*** constants

* Adjust pylint plugin

* Add tests

* Remove single-use function

* Revert logic change

* Revert "Revert logic change"

This reverts commit 60959a0050.

* Tweak again
2022-10-14 16:50:04 +02:00
epenet 8dc3ff72c6
Cleanup config deprecation warning (#80251) 2022-10-14 13:03:17 +02:00
Marc Mueller 4e5b5dfb93
Update pyupgrade to 3.1.0 (#80058)
* Update pyupgrade to 3.1.0

* Remove redundant open modes - text is the default
2022-10-11 09:04:52 +02:00
Marc Mueller af7df260a0
Fix small type issues [core] (#75760) 2022-07-26 16:28:22 +02:00
Kuba Wolanin d8ee9c1922
Add Show logs URL to integration errors notification (#71142) 2022-05-01 16:14:30 -07:00
Will Marler 79080f5e2f
Adjust "default_config" comment in default config (#68679)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2022-03-28 09:03:34 -07:00