Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistPhpLinter.php
| Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | public function supportsReadDataFromStdin() { | ||||
| return false; | return false; | ||||
| } | } | ||||
| protected function parseLinterOutput($path, $err, $stdout, $stderr) { | protected function parseLinterOutput($path, $err, $stdout, $stderr) { | ||||
| // Older versions of php had both on $stdout, newer ones split it | // Older versions of php had both on $stdout, newer ones split it | ||||
| // Combine $stdout and $stderr for consistency | // Combine $stdout and $stderr for consistency | ||||
| $stdout = $stderr."\n".$stdout; | $stdout = $stderr."\n".$stdout; | ||||
| $matches = array(); | $matches = array(); | ||||
| $regex = '/PHP (?<type>.+?) error:\s+(?<error>.*?)\s+in\s+(?<file>.*?)'. | $regex = '/^(?<type>.+?) error:\s+(?<error>.*?)\s+in\s+(?<file>.*?)'. | ||||
| '\s+on line\s+(?<line>\d*)/'; | '\s+on line\s+(?<line>\d*)$/m'; | ||||
| if (preg_match($regex, $stdout, $matches)) { | if (preg_match($regex, $stdout, $matches)) { | ||||
| $type = strtolower($matches['type']); | $type = strtolower($matches['type']); | ||||
| $message = new ArcanistLintMessage(); | $message = new ArcanistLintMessage(); | ||||
| $message->setPath($matches['file']); | $message->setPath($matches['file']); | ||||
| $message->setLine($matches['line']); | $message->setLine($matches['line']); | ||||
| $message->setCode('php.'.$type); | $message->setCode('php.'.$type); | ||||
| $message->setDescription('This file contains a '.$type.' error: '. | $message->setDescription('This file contains a '.$type.' error: '. | ||||
| $matches['error'].' on line '.$matches['line']); | $matches['error'].' on line '.$matches['line']); | ||||
| Show All 10 Lines | |||||