msherry / flycheck-pycheckers

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

Fix mypy --shadow-file parameter order #28

Closed gdiv closed 2 years ago

gdiv commented 5 years ago

Mypy has the following documentation for the --shadow-file parameter:

  --shadow-file SOURCE_FILE SHADOW_FILE
                            When encountering SOURCE_FILE, read and type check
                            the contents of SHADOW_FILE instead.

In the diff the variable filepath stores the path for the temporary file and original_filepath the path of the buffer being edited. We want the temporary file sorted in filepath to be the SHADOW_FILE in order for mypy to read the contents of the SHADOW _FILE instead of SOURCE_FILE.

This fixes the issue where mypy checks only take effect after saving the file.

msherry commented 5 years ago

Hi, @gdiv. Thanks for taking a look at this, and I'm sorry it's taken so long to get back to you! I don't remember exactly what the issue was, but I seem to recall that I had to use this ordering in order to get modules specified in a mypy.ini file to be recognized correctly (with the issue that, as you point out, files are only properly checked after saving). Would you be able to verify whether mypy.ini stanzas are applied correctly with your change? If so and I was just wrong before, I'd be happy to merge this.