Mypy directory exclude in pyproject.toml file not working for pre-commit

52 Views Asked by At

For a project structure:

proj
|-pyproject.toml
|-.pre-commit-config.yml
|-scripts
|-src
|-tests

I want to exclude the test and scripts within the pyproject.toml file as follows:

[tool.mypy]
follow-imports=false
exclude = [
    'tests/', 'scripts/', 'ml/'
    ]

However, after running the: pre-commit run --all-files

from the proj directory root mypy repoert still reports errors from those directories.

the pre-commit yml is as follows: `

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v3.2.0
    hooks:
    -   id: trailing-whitespace
    -   id: end-of-file-fixer
    -   id: check-yaml
    -   id: check-added-large-files- repo: https://github.com/pre-commit/mirrors-mypy
    rev: v1.8.0  # Use the sha / tag you want to point at
    hooks:
      - id: mypy
        args: [--config-file=pyproject.toml]
0

There are 0 best solutions below