msherry / flycheck-pycheckers

Multiple syntax checker for Python in Emacs, using Flycheck
GNU General Public License v3.0
63 stars 23 forks source link

mypy.ini per-file options not respected #2

Closed msherry closed 6 years ago

msherry commented 7 years ago

Flycheck actually runs its checkers over a file named flycheck_<real_file_name>.py, which causes the file-specific sections in mypy.ini files not to match anything. E.g., for the config file

[mypy]
platform = darwin
follow_imports = skip
ignore_missing_imports = True
warn_redundant_casts = True
warn_no_return = True
show_traceback = True
strict_optional = True

[mypy-path.to.file.heres_a_file]
strict_optional = False

the options in the [mypy] section will be correctly applied when checking file heres_a_file.py, but the specific options will not, since flycheck will see it as flycheck_heres_a_file.py.

gvanrossum commented 6 years ago

Might want to look into mypy's --shadow-file option, which was made for this purpose. (It only works for one file though.)