Skip to content

Commit bb3544f

Browse files
authored
Merge pull request #2 from florentchauveau/fix/typecheck-windows-path
Fix parsing typechecking error with Windows file path
2 parents 463ca84 + 872974e commit bb3544f

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

linter.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,30 @@ def find_errors(self, output):
9191
for line in data["Report"]["Error"].splitlines():
9292
if line.count(":") < 3:
9393
continue
94-
parts = line.split(":")
95-
data["Issues"].append({
96-
"FromLinter": "typecheck",
97-
"Text": parts[3].strip(),
98-
"Pos": {
99-
"Filename": parts[0],
100-
"Line": parts[1],
101-
"Column": parts[2],
102-
}
103-
})
94+
if line.startswith("typechecking error: "):
95+
line = line[20:]
96+
if line[1:3] == ":\\": # windows path in filename
97+
parts = line.split(":", 4)
98+
data["Issues"].append({
99+
"FromLinter": "typecheck",
100+
"Text": parts[4].strip(),
101+
"Pos": {
102+
"Filename": ':'.join(parts[0:2]),
103+
"Line": parts[2],
104+
"Column": parts[3],
105+
}
106+
})
107+
else:
108+
parts = line.split(":", 3)
109+
data["Issues"].append({
110+
"FromLinter": "typecheck",
111+
"Text": parts[3].strip(),
112+
"Pos": {
113+
"Filename": parts[0],
114+
"Line": parts[1],
115+
"Column": parts[2],
116+
}
117+
})
104118

105119
"""find relevant issues and yield a LintMatch"""
106120
if data and "Issues" in data:

0 commit comments

Comments
 (0)