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

Check-* ignores exclude directive in mypy.ini #119

Open
2 tasks done
WolfByttner opened this issue Dec 31, 2023 · 0 comments
Open
2 tasks done

Check-* ignores exclude directive in mypy.ini #119

WolfByttner opened this issue Dec 31, 2023 · 0 comments

Comments

@WolfByttner
Copy link

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.16.2
  • PyCharm/IDEA version: Pycharm Professional 2023.3 (Mac)
  • Mypy version: 1.8.0

Step 3: Describe the problem:

The mypy plugin does not appear to respect (or pick up) the exclude directive in a mypy config file. This applies when running all scans (Project/Module/Modified Files/Current Change List). It applies whether I try to ignore one file or multiple files, and whether they are at the root directory or not. Below, I have illustrated the problem with bazelisk.py.

This is the basic structure of the mypy.ini file (note the leading and trailing newlines):


[mypy]
exclude = (?x)(bazelisk\.py)

I have tried different variations of the exclude directive, including the below:

  • exclude = bazelisk\.py
  • exclude = bazelisk.py
  • exclude = ^bazelisk.py
  • exclude = ^bazelisk.py$
  • exclude = ^bazelisk\.py$
  • exclude = bazelisk\.py$
  • exclude = "bazelisk\.py"
  • exclude = (?x)(bazelisk\.py)

Mypy provides the following example file format:

[mypy]
exclude = (?x)(
    ^one\.py$    # files named "one.py"
    | two\.pyi$  # or files ending with "two.pyi"
    | ^three\.   # or files starting with "three."
  )

They also note that "The above is equivalent to: (^one\.py$|two\.pyi$|^three\.)."

These are my mypy settings:

image

I have tried setting the config file both in the Path to config file window and in the Arguments window.

Steps to reproduce:

  1. Add a file called bazelisk.py with mypy errors (I used this file). Note that I added this file in the root folder, but the issue appears to occur no matter the location of the file.
  2. Run any of the mypy checks (Project/Module/Modified Files/Current Change List) in the mypy tab.

Observed Results:

Mypy found errors in bazelisk.py

image

Expected Results:

Mypy should not find errors in bazelisk.py

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

No branches or pull requests

1 participant