mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-18 23:06:31 +00:00
Update hints about type hints (#901)
Co-authored-by: Ruslan Sayfutdinov <ruslan@sayfutdinov.com>
This commit is contained in:
parent
247e9ba0ad
commit
039b12e201
@ -9,7 +9,7 @@ Before you commit any changes, check your work against these requirements:
|
||||
- New dependencies are added to `requirements_all.txt` (if applicable), using `python3 -m script.gen_requirements_all`
|
||||
- New codeowners are added to `CODEOWNERS` (if applicable), using `python3 -m script.hassfest`
|
||||
- The `.coveragerc` file is updated to exclude your platform if there are no tests available or your new code uses a third-party library for communication with the device, service, or sensor. `config_flow.py` can't be excluded as it must be fully tested (100% coverage).
|
||||
- The `.no-strict-typing` file is updated to exclude your code if it doesn't provide a fully type hinted source.
|
||||
- The `.strict-typing` file is updated to include your code if it does provide a fully type hinted source.
|
||||
- The code is formatted using Black, as per these [guidelines](https://developers.home-assistant.io/blog/2019/07/31/black.html). This can be done running the command `black --fast homeassistant tests`.
|
||||
- Documentation is developed for [home-assistant.io](https://home-assistant.io/)
|
||||
- Visit the [website documentation](/documenting.md) for more information about contributing to [home-assistant.io](https://github.com/home-assistant/home-assistant.io).
|
||||
|
@ -73,6 +73,6 @@ _LOGGER.info("Can't connect to the webservice %s at %s", string1, string2)
|
||||
We encourage the use of fully typing your code. This helps with finding/preventing issues and bugs in our codebase,
|
||||
but also helps fellow contributors making adjustments to your code in the future as well.
|
||||
|
||||
By default, Home Assistant will assume everything has type hints and our automated CI process will also check for this.
|
||||
Python modules can be excluded from this behavior by adding an entry to the `.no-strict-typing` file in the
|
||||
root of the Home Assistant Core project.
|
||||
By default, Home Assistant will statically check for type hints and our automated CI process.
|
||||
Python modules can be include for strict checking, if they are fully typed, by adding an entry
|
||||
to the `.strict-typing` file in the root of the Home Assistant Core project.
|
||||
|
@ -24,8 +24,9 @@ We've added a script to start a run of our test suite or a test module and tell
|
||||
**Note:**
|
||||
Applying a monkeytyped stub to a module that has existing typing annotations might error and not work. This tool is most useful for totally untyped modules.
|
||||
|
||||
### Excluding modules from type checking
|
||||
### Including modules for strict type checking
|
||||
|
||||
While we encourage the use of type hints, we currently do not require them for our integrations.
|
||||
By default, our CI assumes files do have type hints. In case the added module doesn't have this, it can be excluded by adding the module to the `.no-strict-typing` file
|
||||
By default, our CI checks statically for type hints. In case a module has been fully typed, it can be
|
||||
marked for enabling strict checks, by adding the module to the `.strict-typing` file
|
||||
that is located at the root of the Home Assistant Core project.
|
||||
|
Loading…
x
Reference in New Issue
Block a user