diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 88fb5be..c6b876e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,6 +14,13 @@ repos: - id: debug-statements - id: end-of-file-fixer - id: mixed-line-ending + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.8.0 + hooks: + - id: mypy + # yaml requires additional stubs. + # Similar to: https://stackoverflow.com/a/73603491/5755604 + additional_dependencies: ['types-PyYAML'] - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.1.11 hooks: diff --git a/pyproject.toml b/pyproject.toml index 31e963c..d8a30d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,10 +35,24 @@ version = {attr = "forensicsim.__version__"} dev=[ "build", "pre-commit", + "mypy", "ruff", "tox", ] +[tool.mypy] + +python_version = "3.9" + +exclude = [ + "tools/" +] + +# https://github.com/python/mypy/issues/2410 +ignore_missing_imports = true +disallow_untyped_defs = true +disallow_untyped_calls = true +disallow_incomplete_defs = true [tool.ruff] @@ -103,6 +117,7 @@ commands = # Syntax Checks [testenv:lint] commands = + python -m mypy src/ python -m ruff --output-format=github src python -m ruff format src --check