diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 78b7ec29859e1a935907f4183600cac2fb389dca..8e8792e88c945312046f25e1d353b0b8c7dacbba 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,3 +13,7 @@ repos: additional_dependencies: - flake8-docstrings==1.3.1 - pydocstyle==4.0.0 +- repo: https://github.com/pre-commit/mirrors-mypy.git + rev: v0.730 + hooks: + - id: mypy diff --git a/azure-pipelines-ci.yml b/azure-pipelines-ci.yml index 13f0915bc56f125ed9c902ceb385a4638291fede..74e9ea107c56cd481dc2866cac074ac18b6f98e2 100644 --- a/azure-pipelines-ci.yml +++ b/azure-pipelines-ci.yml @@ -166,9 +166,6 @@ stages: pip install -r requirements_test.txt -c homeassistant/package_constraints.txt displayName: 'Setup Env' - script: | - TYPING_FILES=$(cat mypyrc) - echo -e "Run mypy on: \n$TYPING_FILES" - . venv/bin/activate - mypy $TYPING_FILES + mypy homeassistant displayName: 'Run mypy' diff --git a/mypyrc b/mypyrc deleted file mode 100644 index 08413ecd23c6968b6f40ab5c9a9e65e2b96bc6ae..0000000000000000000000000000000000000000 --- a/mypyrc +++ /dev/null @@ -1,38 +0,0 @@ -homeassistant/*.py -homeassistant/auth/ -homeassistant/components/*.py -homeassistant/components/automation/ -homeassistant/components/binary_sensor/ -homeassistant/components/calendar/ -homeassistant/components/camera/ -homeassistant/components/cover/ -homeassistant/components/device_automation/ -homeassistant/components/frontend/ -homeassistant/components/geo_location/ -homeassistant/components/group/ -homeassistant/components/history/ -homeassistant/components/http/ -homeassistant/components/image_processing/ -homeassistant/components/integration/ -homeassistant/components/light/ -homeassistant/components/lock/ -homeassistant/components/mailbox/ -homeassistant/components/media_player/ -homeassistant/components/notify/ -homeassistant/components/persistent_notification/ -homeassistant/components/proximity/ -homeassistant/components/remote/ -homeassistant/components/scene/ -homeassistant/components/sensor/ -homeassistant/components/sun/ -homeassistant/components/switch/ -homeassistant/components/systemmonitor/ -homeassistant/components/tts/ -homeassistant/components/vacuum/ -homeassistant/components/water_heater/ -homeassistant/components/weather/ -homeassistant/components/websocket_api/ -homeassistant/components/zone/ -homeassistant/helpers/ -homeassistant/scripts/ -homeassistant/util/ diff --git a/setup.cfg b/setup.cfg index 4c9c892b93fbb48104030fba6b5121891920a2e5..6d0e5378b44de9f231d9dc9b92d0734f62e4fe62 100644 --- a/setup.cfg +++ b/setup.cfg @@ -57,17 +57,21 @@ combine_as_imports = true [mypy] python_version = 3.6 +ignore_errors = true +follow_imports = silent +ignore_missing_imports = true +warn_incomplete_stub = true +warn_redundant_casts = true +warn_unused_configs = true + +[mypy-homeassistant.bootstrap,homeassistant.components,homeassistant.config_entries,homeassistant.config,homeassistant.const,homeassistant.core,homeassistant.data_entry_flow,homeassistant.exceptions,homeassistant.loader,homeassistant.__main__,homeassistant.monkey_patch,homeassistant.requirements,homeassistant.setup,homeassistant.util,homeassistant.auth.*,homeassistant.components.automation.*,homeassistant.components.binary_sensor.*,homeassistant.components.calendar.*,homeassistant.components.cover.*,homeassistant.components.device_automation.*,homeassistant.components.frontend.*,homeassistant.components.geo_location.*,homeassistant.components.group.*,homeassistant.components.history.*,homeassistant.components.http.*,homeassistant.components.image_processing.*,homeassistant.components.integration.*,homeassistant.components.light.*,homeassistant.components.lock.*,homeassistant.components.mailbox.*,homeassistant.components.media_player.*,homeassistant.components.notify.*,homeassistant.components.persistent_notification.*,homeassistant.components.proximity.*,homeassistant.components.remote.*,homeassistant.components.scene.*,homeassistant.components.sensor.*,homeassistant.components.sun.*,homeassistant.components.switch.*,homeassistant.components.systemmonitor.*,homeassistant.components.tts.*,homeassistant.components.vacuum.*,homeassistant.components.water_heater.*,homeassistant.components.weather.*,homeassistant.components.websocket_api.*,homeassistant.components.zone.*,homeassistant.helpers.*,homeassistant.scripts.*,homeassistant.util.*] +ignore_errors = false check_untyped_defs = true disallow_incomplete_defs = true disallow_untyped_calls = true disallow_untyped_defs = true -follow_imports = silent -ignore_missing_imports = true no_implicit_optional = true strict_equality = true -warn_incomplete_stub = true -warn_redundant_casts = true warn_return_any = true warn_unreachable = true -warn_unused_configs = true warn_unused_ignores = true diff --git a/tox.ini b/tox.ini index 2d4cf7c54ba2bf03ec270e8f1f1c5b3d296b53ab..8c3563dac837c8177dbf31987eef0372a6828037 100644 --- a/tox.ini +++ b/tox.ini @@ -37,9 +37,8 @@ commands = flake8 {posargs: homeassistant tests script} [testenv:typing] -whitelist_externals=/bin/bash deps = -r{toxinidir}/requirements_test.txt -c{toxinidir}/homeassistant/package_constraints.txt commands = - /bin/bash -c 'TYPING_FILES=$(cat mypyrc); mypy $TYPING_FILES' + mypy homeassistant