leinardi / mypy-pycharm

A plugin providing both real-time and on-demand scanning of Python files with Mypy from within PyCharm/IDEA.
Apache License 2.0
194 stars 31 forks source link

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

Open WolfByttner opened 9 months ago

WolfByttner commented 9 months ago

Step 1: Are you in the right place?

Step 2: Describe your environment

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:

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

sombek commented 1 month ago

having the same issue