Closed yayachiken closed 4 years ago
Note that there might still be another bug here as MyPy optionally allows for giving out line-colums in location specifiers (e.g. path/to/file.py:123:45: error: ...
which should trigger a similar bug or maybe reject the line completely...
But I did not try to "fix" this as I have not yet used the columns option and do not know whether it is indeed a problem.
Thanks. Any specific tool you want released with this fix?
I noticed this bug in Jenkins and tracked this library down via:
But the bug is not super-critical for me personally, and those projects seem to regularily update their dependencies, so the fix will probably eventually trickle down.
It turns out that MyPy may print error messages that contain colons
:
which are used by the parser to delimit fields. This causes the parser to swallow the part of the error message betweenerror:
and the last colon:
in the error message.Fortunately we can just non-greedy match the error specifier as that most likely will always be an alphanumeric string and never contain a colon.
I've also written a test that displays the observed error behaviour. As I observed the actual bug in a work environment, I took an anonymous, equivalent error message from the MyPy test suite.