Skip to content

Commit

Permalink
Run mypy in pre-commit (home-assistant#27339)
Browse files Browse the repository at this point in the history
* Move mypy files config to setup.cfg

* Add mypy in pre-commit
  • Loading branch information
scop authored and balloob committed Oct 8, 2019
1 parent d345b58 commit 3e6b9a1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 49 deletions.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 1 addition & 4 deletions azure-pipelines-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
38 changes: 0 additions & 38 deletions mypyrc

This file was deleted.

14 changes: 9 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 1 addition & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3e6b9a1

Please sign in to comment.