Fix MyPy linter message REGEX to handle any python extension#2402
Fix MyPy linter message REGEX to handle any python extension#2402DonJayamanne merged 2 commits intomicrosoft:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2402 +/- ##
==========================================
+ Coverage 75.38% 75.39% +<.01%
==========================================
Files 309 309
Lines 14331 14331
Branches 2537 2537
==========================================
+ Hits 10804 10805 +1
+ Misses 3518 3517 -1
Partials 9 9
Continue to review full report at Codecov.
|
d3r3kk
left a comment
There was a problem hiding this comment.
First, thank you for taking the time to submit this PR.
However, I'm not going to approve this as I want @brettcannon or @ericsnowcurrently's eyes on it first.
...handle any python [file] extension...
I'm not sure allowing any file extension at all is a great idea here. I think I could get behind explicit python file extensions, but to simply guess and assume that only python files will be picked up seems a bit too loose perhaps?
I assume that mypy will only pick up relevant Python files, can we always rely on that being true?
|
(Also, before I would accept this I'd want to see some tests to ensure that it is exhibiting the behaviour you desire and not any undesired behaviours as well) |
|
Maybe @DonJayamanne remembers a reason to explicitly match a |
|
And can I ask what the use-case is? Since |
|
It already runs MyPy and PyLinter with the .pyi files, as you can see in the output log of #2380. This modification is just for the RegEx to filter the MyPy output to catch the messages that should be sent to to the problems tab. Also, the pylint messages for .pyi files are already working, and they don't even have the filename in them (the terminal output parsed by the extension). As for the use, in my specific case, I do them to write the API "interface", to model it before writing the code, using typing hints to check any mistake taken in this part. So MyPy should never run code in fact, just check the typing soundness of the interfaces (methods signatures, class members, etc). |
Fixes #2380
The regex expression to match MyPy linter messages expects that the file name has a
.pyextension, that isn't always the case. E.g.,.pyifiles for describing interfaces."1.2.3", not"^1.2.3")package-lock.jsonhas been regenerated if dependencies have changed