Skip to content

strange behavior of exclude option #11190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bluebrown opened this issue Sep 25, 2021 · 3 comments
Closed

strange behavior of exclude option #11190

bluebrown opened this issue Sep 25, 2021 · 3 comments
Labels
bug mypy got something wrong

Comments

@bluebrown
Copy link

Bug Report

To Reproduce
When I run mypy from the command line, I can see it's using the exclude option specified in setup.cfg.

[mypy]
python_executable = .venv/bin/python
exclude = alembic
warn_return_any = True
warn_unused_configs = True
disallow_untyped_defs = True
disallow_untyped_decorators = True
warn_redundant_casts = True
warn_unreachable = True
warn_unused_ignores = True
show_column_numbers = True
ignore_missing_imports = True

But VS Code is marking the files in the excluded alembic folder still with errors. Providing an additional flag in settings.json didn't help either.

"python.linting.mypyEnabled": true,
"python.linting.mypyArgs": [
  "--exclude=alembic"
],

I managed to get it working with `python.linting.ignorePatterns``.

"python.linting.ignorePatterns": [
  "alembic/**/*.py"
],

I found out that the same problem occurs with another tool. So this probably unrelated to VS Code. When I run my pre-commit hook. All options are picked up, but it's not excluding the pattern given in exclude.

- repo: https://github.com/pre-commit/mirrors-mypy
  rev: v0.910
  hooks:
    - id: mypy
      additional_dependencies: [tokenize-rt==4.1.0]

Providing it with an extra flag there also doesn't help. Unfortunately, I have found a workaround like in VS Code for the hook so far.

Your Environment

  • Mypy version used: v0.910
  • Python version used: 3.8
  • Operating system and version: ubuntu20.04 (wsl2)
@bluebrown bluebrown added the bug mypy got something wrong label Sep 25, 2021
@emmatyping
Copy link
Member

I found out that the same problem occurs with another tool. So this probably unrelated to VS Code.

This would lead me to the opposite conclusion. If the issue happens with and without mypy, wouldn't that mean its more likely VSCode's fault?

@bluebrown
Copy link
Author

bluebrown commented Sep 25, 2021

Two separate tools, VS Code and pre-commit, having both problems propagating exclude to the underlying mypy installation. It is this hook https://github.com/pre-commit/mirrors-mypy. Pre commit runs on git commit, it is unrelated to VS Code.

Not, VS Code has issues setting this for 2 tools. But 2 tools having issues setting this for mypy.

@emmatyping
Copy link
Member

Ah this seems to be a duplicate of #11094. I'll leave a comment there explaining things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

2 participants