Skip to content

Commit

Permalink
CI: Add type checking
Browse files Browse the repository at this point in the history
  • Loading branch information
dext0r committed Aug 18, 2023
1 parent af810eb commit e20fae1
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ jobs:
run: |
pip install -r tests/requirements_${{ matrix.ha-version }}.txt
# https://github.com/python/mypy/issues/8545
- name: Fix homeassistant type checking
run: |
python -c 'from pathlib import Path; import homeassistant; (Path(homeassistant.__file__).parent / Path("py.typed")).touch()'
- name: Type checking
run: mypy .

- name: Test with pytest
run: pytest --cov-report xml --cov

Expand Down
83 changes: 83 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,86 @@ exclude_also = [
omit = [
"tests/*"
]

[tool.mypy]
python_version = 3.11
plugins = ["pydantic.mypy"]
follow_imports_for_stubs = true
local_partial_types = true
strict_equality = true
warn_redundant_casts = true
warn_unused_ignores = true
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true

[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = true

[[tool.mypy.overrides]]
module= "custom_components.yandex_smart_home"
ignore_errors = true

[[tool.mypy.overrides]]
module= "custom_components.yandex_smart_home.config_flow"
ignore_errors = true

[[tool.mypy.overrides]]
module= "custom_components.yandex_smart_home.cloud"
ignore_errors = true

[[tool.mypy.overrides]]
module= "custom_components.yandex_smart_home.cloud_stream"
ignore_errors = true

[[tool.mypy.overrides]]
module= "custom_components.yandex_smart_home.notifier"
ignore_errors = true

[[tool.mypy.overrides]]
module= "custom_components.yandex_smart_home.smart_home"
ignore_errors = true

[[tool.mypy.overrides]]
module= "custom_components.yandex_smart_home.entity"
ignore_errors = true

[[tool.mypy.overrides]]
module= "custom_components.yandex_smart_home.http"
ignore_errors = true

[[tool.mypy.overrides]]
module= "custom_components.yandex_smart_home.helpers"
ignore_errors = true

[[tool.mypy.overrides]]
module= "custom_components.yandex_smart_home.prop"
ignore_errors = true

[[tool.mypy.overrides]]
module= "custom_components.yandex_smart_home.prop_custom"
ignore_errors = true

[[tool.mypy.overrides]]
module= "custom_components.yandex_smart_home.prop_event"
ignore_errors = true

[[tool.mypy.overrides]]
module= "custom_components.yandex_smart_home.prop_float"
ignore_errors = true

[[tool.mypy.overrides]]
module= "custom_components.yandex_smart_home.config_validation"
ignore_errors = true

[[tool.mypy.overrides]]
module = "tests.*"
ignore_errors = true
1 change: 1 addition & 0 deletions tests/requirements_2023.7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ pytest-homeassistant-custom-component==0.13.42
aiohttp-cors==0.7.0
home_assistant_intents==2023.7.24
hassil==1.2.0
mypy==1.4.1

0 comments on commit e20fae1

Please sign in to comment.