Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P1911
Masterwork From Distant Lands
Active
Public
Actions
Authored by
chengyin
on Dec 22 2015, 3:55 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F1038766: Masterwork From Distant Lands
Dec 22 2015, 3:55 AM
2015-12-22 03:55:55 (UTC+0)
Subscribers
None
diff --git a/src/lint/linter/ArcanistESLintLinter.php b/src/lint/linter/ArcanistESLintLinter.php
index 3ed84be..8d4b71c 100644
--- a/src/lint/linter/ArcanistESLintLinter.php
+++ b/src/lint/linter/ArcanistESLintLinter.php
@@ -105,6 +105,27 @@ final class ArcanistESLintLinter extends ArcanistExternalLinter {
return true;
}
+ protected function getDefaultMessageSeverity($code) {
+ // since severity is provided in the output, here
+ // we simply output `NULL` so the output result could
+ // be used
+ return NULL;
+ }
+
+ protected function getESLintMessageSeverity($code, $outputtedSeverity) {
+ // allow overwrite through config
+ $severityWithCode = $this->getLintMessageSeverity($code);
+
+ if (!is_null($severityWithCode)) {
+ return $severityWithCode;
+ }
+
+ // did not overwrite, output the original severity
+ return $outputtedSeverity === 'error' ?
+ ArcanistLintSeverity::SEVERITY_ERROR :
+ ArcanistLintSeverity::SEVERITY_WARNING;
+ }
+
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
$lines = phutil_split_lines($stdout, false);
@@ -116,20 +137,20 @@ final class ArcanistESLintLinter extends ArcanistExternalLinter {
if (isset($parts[1]) &&
($parts[1] === 'error' || $parts[1] === 'warning')) {
- $severity = $parts[1] === 'error' ?
- ArcanistLintSeverity::SEVERITY_ERROR :
- ArcanistLintSeverity::SEVERITY_WARNING;
list($line, $char) = explode(':', $parts[0]);
+ $severity = $parts[1];
+ $code = end($parts);
+ $description = implode(' ', array_slice($parts, 2, count($parts) - 3));
$message = new ArcanistLintMessage();
$message->setPath($path);
$message->setLine($line);
$message->setChar($char);
- $message->setCode($this->getLinterName());
+ $message->setCode($code);
$message->setName($this->getLinterName());
- $message->setDescription(implode(' ', $parts));
- $message->setSeverity($severity);
+ $message->setDescription($description);
+ $message->setSeverity($this->getESLintMessageSeverity($code, $severity));
$messages[] = $message;
}
Event Timeline
chengyin
edited the content of this paste.
(Show Details)
Dec 22 2015, 3:55 AM
2015-12-22 03:55:55 (UTC+0)
chengyin
changed the title of this paste from untitled to
Masterwork From Distant Lands
.
chengyin
mentioned this in
D12198: Added ESLint Support
.
Dec 22 2015, 4:03 AM
2015-12-22 04:03:53 (UTC+0)
Log In to Comment