From ea06931b38198bdfc6cd2b6bb2c407e6c90cf33a Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Sat, 27 Nov 2021 13:46:32 +0000 Subject: [PATCH] set up mypy hook for incremental adoption --- .pre-commit-config.yaml | 14 ++++++++++---- pyproject.toml | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 14aa0ee4..57bc9691 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,11 @@ repos: -- repo: https://github.com/ambv/black - rev: 20.8b1 - hooks: - - id: black + - repo: https://github.com/ambv/black + rev: 20.8b1 + hooks: + - id: black + + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v0.910 + hooks: + - id: mypy + pass_filenames: false diff --git a/pyproject.toml b/pyproject.toml index 8326398a..194812ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,6 +42,46 @@ skip_glob = ["*/setup.py"] filter_files = true known_first_party = "cleo" +[tool.mypy] +strict = true +files = "cleo, tests" + +# The following whitelist is used to allow for incremental adoption +# of Mypy. Modules should be removed from this whitelist as and when +# their respective type errors have been addressed. No new modules +# should be added to this whitelist. + +[[tool.mypy.overrides]] +module = [ + "cleo._utils", + "cleo.application", + "cleo.descriptors.*", + "cleo.color", + "cleo.commands.*", + "cleo.events.*", + "cleo.formatters.*", + "cleo.io.*", + "cleo.loaders.*", + "cleo.parser", + "cleo.terminal", + "cleo.testers.*", + "cleo.ui.*", + "tests.commands.*", + "tests.conftest", + "tests.events.*", + "tests.fixtures.*", + "tests.formatters.*", + "tests.io.*", + "tests.loaders.*", + "tests.test_application", + "tests.test_color", + "tests.test_helpers", + "tests.test_parser", + "tests.testers.*", + "tests.ui.*", +] +ignore_errors = true + [build-system] requires = ["poetry-core~=1.0"]