Skip to content

Commit

Permalink
Don't construct intermediate dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
bgamari committed Dec 4, 2015
1 parent 26b75e3 commit 85ece0f
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/ArcanistExternalJsonLinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,28 +169,31 @@ public function lintPath($path) {
$char = null;
}

$dict = array(
'path' => idx($message, 'file', $path),
'line' => $line,
'char' => $char,
'code' => idx($message, 'code', $this->getLinterName()),
'severity' => $this->getMessageSeverity($message),
'name' => idx($message, 'name', 'Lint'),
'description' => idx($message, 'message',
pht('Undefined Lint Message')),
);
$path = idx($message, 'file', $path);
$code = idx($message, 'code', $this->getLinterName());
$severity = $this->getMessageSeverity($message);
$name = idx($message, 'name', 'Lint');
$description = idx($message, 'message', pht('Undefined Lint Message'));

$lint = id(new ArcanistLintMessage())
->setPath($path)
->setLine($line)
->setChar($char)
->setCode($this->getLinterName())
->setSeverity($severity)
->setName($name)
->setDescription($description);

$original = idx($message, 'original');
if ($original !== null) {
$dict['original'] = $original;
$lint->setOriginalText($originalText);
}

$replacement = idx($message, 'replacement');
if ($replacement !== null) {
$dict['replacement'] = $replacement;
$lint->setReplacementText($replacement);
}

$lint = ArcanistLintMessage::newFromDictionary($dict);
$this->addLintMessage($lint);
}
}
Expand Down

0 comments on commit 85ece0f

Please sign in to comment.