Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistPhpLinter.php
| Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | 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: +(?<error>.+) in (?<file>.+) '. | $regex = '/^(PHP )?(?<type>.+) error: +(?<error>.+) in (?<file>.+) '. | ||||
| 'on line (?<line>\d+)$/m'; | 'on line (?<line>\d+)$/m'; | ||||
| if (preg_match($regex, $stdout, $matches)) { | if (preg_match($regex, $stdout, $matches)) { | ||||
| $code = $this->getLintCodeFromLinterConfigurationKey($matches['type']); | |||||
| $message = id(new ArcanistLintMessage()) | $message = id(new ArcanistLintMessage()) | ||||
| ->setPath($path) | ->setPath($path) | ||||
| ->setLine($matches['line']) | ->setLine($matches['line']) | ||||
| ->setCode($this->getLinterName().$code) | ->setCode($this->getLintCodeFromLinterConfigurationKey( | ||||
| ->setName($this->getLintMessageName($code)) | $matches['type'])) | ||||
| ->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR) | |||||
| ->setDescription($matches['error']); | ->setDescription($matches['error']); | ||||
| // `php -l` only returns the first error. | // `php -l` only returns the first error. | ||||
| return array($message); | return array($message); | ||||
| } | } | ||||
| return array(); | return array(); | ||||
| } | } | ||||
| Show All 15 Lines | |||||