Skip to content
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

Exclude doesn't work with files #11760

Closed
Timmmm opened this issue Dec 15, 2021 · 2 comments
Closed

Exclude doesn't work with files #11760

Timmmm opened this issue Dec 15, 2021 · 2 comments
Labels
bug mypy got something wrong

Comments

@Timmmm
Copy link

Timmmm commented Dec 15, 2021

Bug Report

If you specify some files for mypy to find with the files = config option, then exclude can't let you ignore them. E.g.

To Reproduce

$ cat mypy.ini
[mypy]
files = **/*.py
exclude = .*
$ cat foo/bar.py 
asdsdfsdf
$ mypy
foo/bar.py:1: error: Name "asdsdfsdf" is not defined
Found 1 error in 1 file (checked 1 source file)

Expected Behavior

exclude should override files.

Your Environment

  • Mypy version used: 0.910
  • Mypy command-line flags: See above
  • Mypy configuration options from mypy.ini (and other config files): See above
  • Python version used: 3.8
  • Operating system and version: Centos of some kind
@Timmmm Timmmm added the bug mypy got something wrong label Dec 15, 2021
@hauntsaninja
Copy link
Collaborator

This is documented behaviour: https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-exclude

If you pass a file or module explicitly it will still be checked. For instance, mypy --exclude '/setup.py$' but_still_check/setup.py.

Consider using per-module ignore errors

@Timmmm
Copy link
Author

Timmmm commented Dec 16, 2021

Ah it's not clear that files = ... is the same as passing files on the command line. Maybe worth documenting.

It would be nice if there was a way to do files_exclude = ... but for now I will just run Mypy over each file one by one using a script. :-/

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