Skip to content

Commit 467fdf1

Browse files
message may include leading spaces
1 parent ba6afdb commit 467fdf1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mypy/test/data.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ def expand_errors(input: list[str], output: list[str], fnam: str) -> None:
535535
# The first in the split things isn't a comment
536536
for possible_err_comment in re.split(r"(?!\\)#\s*(?=[ENW]\s*:)", input[i])[1:]:
537537
m = re.search(
538-
r"^([ENW])\s*:((?P<col>\d+):)?\s*(?P<message>.*)$", possible_err_comment.strip()
538+
r"^([ENW])\s*:((?P<col>\d+):)?(?P<message>.*)$", possible_err_comment.strip()
539539
)
540540
if m:
541541
if m.group(1) == "E":
@@ -545,12 +545,12 @@ def expand_errors(input: list[str], output: list[str], fnam: str) -> None:
545545
elif m.group(1) == "W":
546546
severity = "warning"
547547
col = m.group("col")
548-
message = m.group("message")
548+
message = m.group("message") # Message may, and probably does, include leading spaces
549549
message = message.replace(r"\#", "#") # adds back escaped # character
550550
if col is None:
551-
output.append(f"{fnam}:{i + 1}: {severity}: {message}")
551+
output.append(f"{fnam}:{i + 1}: {severity}:{message}")
552552
else:
553-
output.append(f"{fnam}:{i + 1}:{col}: {severity}: {message}")
553+
output.append(f"{fnam}:{i + 1}:{col}: {severity}:{message}")
554554

555555

556556
def fix_win_path(line: str) -> str:

0 commit comments

Comments
 (0)