Move mypy to pre-commit

This commit is contained in:
Gabriel Augendre 2021-12-29 16:19:31 +01:00
parent 0266a32b5b
commit 2b9e5fa5d0
4 changed files with 12 additions and 4 deletions

View file

@ -71,3 +71,12 @@ repos:
additional_dependencies: additional_dependencies:
- eslint@^7.29.0 - eslint@^7.29.0
- eslint-config-prettier@^8.3.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"]

View file

@ -63,7 +63,6 @@ env = [
[tool.mypy] [tool.mypy]
mypy_path = "$MYPY_CONFIG_FILE_DIR/stubs:$MYPY_CONFIG_FILE_DIR/src" mypy_path = "$MYPY_CONFIG_FILE_DIR/stubs:$MYPY_CONFIG_FILE_DIR/src"
exclude = "/migrations/"
[[tool.mypy.overrides]] [[tool.mypy.overrides]]
module = [ module = [

View file

@ -7,7 +7,7 @@ class Migration(migrations.Migration):
initial = True initial = True
dependencies = [] dependencies: list[str] = []
operations = [ operations = [
migrations.CreateModel( migrations.CreateModel(

View file

@ -33,10 +33,10 @@ def pre_commit(ctx):
@task @task
def mypy(ctx): def mypy(ctx):
with ctx.cd(BASE_DIR): 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): def check(ctx):
pass pass