mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 00:32:41 +01:00
Parse JSON as an associate array.
Summary: It seems that in some situations, JSHint does not set the `evidence` property. In such cases, PHP fails with `Undefined property: stdClass::$evidence`. It would be safer to access the error object as an associative array rather than as `stdClass`. Test Plan: N/A Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D8993
This commit is contained in:
parent
8523b98f39
commit
9a13c87ac4
1 changed files with 8 additions and 8 deletions
|
@ -84,7 +84,7 @@ final class ArcanistJSHintLinter extends ArcanistExternalLinter {
|
|||
}
|
||||
|
||||
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
|
||||
$errors = json_decode($stdout);
|
||||
$errors = json_decode($stdout, true);
|
||||
|
||||
if (!is_array($errors)) {
|
||||
// Something went wrong and we can't decode the output. Exit abnormally.
|
||||
|
@ -98,13 +98,13 @@ final class ArcanistJSHintLinter extends ArcanistExternalLinter {
|
|||
foreach ($errors as $err) {
|
||||
$message = new ArcanistLintMessage();
|
||||
$message->setPath($path);
|
||||
$message->setLine($err->line);
|
||||
$message->setChar($err->col);
|
||||
$message->setCode($err->code);
|
||||
$message->setName('JSHint'.$err->code);
|
||||
$message->setDescription($err->reason);
|
||||
$message->setSeverity($this->getLintMessageSeverity($err->code));
|
||||
$message->setOriginalText($err->evidence);
|
||||
$message->setLine(idx($err, 'line'));
|
||||
$message->setChar(idx($err, 'col'));
|
||||
$message->setCode(idx($err, 'code'));
|
||||
$message->setName('JSHint'.idx($err, 'code'));
|
||||
$message->setDescription(idx($err, 'reason'));
|
||||
$message->setSeverity($this->getLintMessageSeverity(idx($err, 'code')));
|
||||
$message->setOriginalText(idx($err, 'evidence'));
|
||||
|
||||
$messages[] = $message;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue