Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistPEP8Linter.php
| Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | protected function parseLinterOutput($path, $err, $stdout, $stderr) { | ||||
| foreach ($lines as $line) { | foreach ($lines as $line) { | ||||
| $matches = null; | $matches = null; | ||||
| if (!preg_match('/^(.*?):(\d+):(\d+): (\S+) (.*)$/', $line, $matches)) { | if (!preg_match('/^(.*?):(\d+):(\d+): (\S+) (.*)$/', $line, $matches)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| foreach ($matches as $key => $match) { | foreach ($matches as $key => $match) { | ||||
| $matches[$key] = trim($match); | $matches[$key] = trim($match); | ||||
| } | } | ||||
| $message = new ArcanistLintMessage(); | |||||
| $message->setPath($path); | |||||
| $message->setLine($matches[2]); | |||||
| $message->setChar($matches[3]); | |||||
| $message->setCode($matches[4]); | |||||
| $message->setName('PEP8 '.$matches[4]); | |||||
| $message->setDescription($matches[5]); | |||||
| $message->setSeverity($this->getLintMessageSeverity($matches[4])); | |||||
| $messages[] = $message; | $messages[] = id(new ArcanistLintMessage()) | ||||
| ->setPath($path) | |||||
| ->setLine($matches[2]) | |||||
| ->setChar($matches[3]) | |||||
| ->setCode($matches[4]) | |||||
| ->setDescription($matches[5]); | |||||
| } | } | ||||
| return $messages; | return $messages; | ||||
| } | } | ||||
| protected function getDefaultMessageSeverity($code) { | protected function getDefaultMessageSeverity($code) { | ||||
| if (preg_match('/^W/', $code)) { | if (preg_match('/^W/', $code)) { | ||||
| return ArcanistLintSeverity::SEVERITY_WARNING; | return ArcanistLintSeverity::SEVERITY_WARNING; | ||||
| Show All 20 Lines | |||||