Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistPhpLinter.php
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | protected function parseLinterOutput($path, $err, $stdout, $stderr) { | ||||
$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']); | $code = $this->getLintCodeFromLinterConfigurationKey($matches['type']); | ||||
$message = id(new ArcanistLintMessage()) | $message = (new ArcanistLintMessage()) | ||||
->setPath($path) | ->setPath($path) | ||||
->setLine($matches['line']) | ->setLine($matches['line']) | ||||
->setCode($this->getLinterName().$code) | ->setCode($this->getLinterName().$code) | ||||
->setName($this->getLintMessageName($code)) | ->setName($this->getLintMessageName($code)) | ||||
->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR) | ->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR) | ||||
->setDescription($matches['error']); | ->setDescription($matches['error']); | ||||
// `php -l` only returns the first error. | // `php -l` only returns the first error. | ||||
Show All 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0