Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistPyLintLinter.php
| Show First 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | protected function parseLinterOutput($path, $err, $stdout, $stderr) { | ||||
| foreach ($lines as $line) { | foreach ($lines as $line) { | ||||
| $matches = explode('|', $line, 5); | $matches = explode('|', $line, 5); | ||||
| if (count($matches) < 5) { | if (count($matches) < 5) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| // NOTE: PyLint sometimes returns -1 as the character offset for a | |||||
| // message. If it does, treat it as 0. See T9257. | |||||
| $char = (int)$matches[1]; | |||||
| $char = max(0, $char); | |||||
| $message = id(new ArcanistLintMessage()) | $message = id(new ArcanistLintMessage()) | ||||
| ->setPath($path) | ->setPath($path) | ||||
| ->setLine($matches[0]) | ->setLine($matches[0]) | ||||
| ->setChar($matches[1]) | ->setChar($char) | ||||
| ->setCode($matches[2]) | ->setCode($matches[2]) | ||||
| ->setSeverity($this->getLintMessageSeverity($matches[2])) | ->setSeverity($this->getLintMessageSeverity($matches[2])) | ||||
| ->setName(ucwords(str_replace('-', ' ', $matches[3]))) | ->setName(ucwords(str_replace('-', ' ', $matches[3]))) | ||||
| ->setDescription($matches[4]); | ->setDescription($matches[4]); | ||||
| $messages[] = $message; | $messages[] = $message; | ||||
| } | } | ||||
| Show All 34 Lines | |||||