From 2b9e5fa5d0ecf5573fedaed6234b89b498c70074 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Wed, 29 Dec 2021 16:19:31 +0100 Subject: [PATCH] Move mypy to pre-commit --- .pre-commit-config.yaml | 9 +++++++++ pyproject.toml | 1 - src/attachments/migrations/0001_initial.py | 2 +- tasks.py | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9f52db6..8225d7c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -71,3 +71,12 @@ repos: additional_dependencies: - eslint@^7.29.0 - eslint-config-prettier@^8.3.0 + - repo: local + hooks: + - id: mypy + name: mypy + entry: mypy + language: system + types: [python] + exclude: tasks.py$ + args: ["--cache-dir=/dev/null"] diff --git a/pyproject.toml b/pyproject.toml index 7323d9a..f594f43 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,7 +63,6 @@ env = [ [tool.mypy] mypy_path = "$MYPY_CONFIG_FILE_DIR/stubs:$MYPY_CONFIG_FILE_DIR/src" -exclude = "/migrations/" [[tool.mypy.overrides]] module = [ diff --git a/src/attachments/migrations/0001_initial.py b/src/attachments/migrations/0001_initial.py index 4134823..69240de 100644 --- a/src/attachments/migrations/0001_initial.py +++ b/src/attachments/migrations/0001_initial.py @@ -7,7 +7,7 @@ class Migration(migrations.Migration): initial = True - dependencies = [] + dependencies: list[str] = [] operations = [ migrations.CreateModel( diff --git a/tasks.py b/tasks.py index 318d452..b6514dc 100644 --- a/tasks.py +++ b/tasks.py @@ -33,10 +33,10 @@ def pre_commit(ctx): @task def mypy(ctx): with ctx.cd(BASE_DIR): - ctx.run("mypy src", pty=True) + ctx.run("pre-commit run --all-files mypy", pty=True) -@task(pre=[pre_commit, mypy, test_cov]) +@task(pre=[pre_commit, test_cov]) def check(ctx): pass