Skip to content

Commit 72f651d

Browse files
committed
Capture filename and error code
1 parent d5e91e5 commit 72f651d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

linter.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ class TemporaryDirectory(Protocol):
4949
class Mypy(PythonLinter):
5050
"""Provides an interface to mypy."""
5151

52-
regex = r'^(\w:)?[^:]+:(?P<line>\d+):((?P<col>\d+):)?\s*(?P<error_type>[^:]+):\s*(?P<message>.+)'
52+
regex = (
53+
r'^(?P<filename>.+?):(?P<line>\d+):((?P<col>\d+):)?\s*'
54+
r'(?P<error_type>[^:]+):\s*(?P<message>.+?)(\s\s\[(?P<code>.+)\])?$'
55+
)
5356
line_col_base = (1, 1)
5457
tempfile_suffix = 'py'
5558
default_type = const.WARNING
@@ -63,6 +66,7 @@ class Mypy(PythonLinter):
6366
"--cache-dir:": "",
6467
# Allow users to disable this
6568
"--incremental": True,
69+
"--show-error-codes": True,
6670
# Need this to silent lints for other files. Alternatively: 'skip'
6771
"--follow-imports:": "silent",
6872
}

0 commit comments

Comments
 (0)