Page MenuHomePhabricator

D10690.diff
No OneTemporary

D10690.diff

diff --git a/src/lint/linter/ArcanistClosureLinter.php b/src/lint/linter/ArcanistClosureLinter.php
--- a/src/lint/linter/ArcanistClosureLinter.php
+++ b/src/lint/linter/ArcanistClosureLinter.php
@@ -17,6 +17,20 @@
return pht("Uses Google's Closure Linter to check Javascript code.");
}
+ protected function getLintCodeFromLinterConfigurationKey($code) {
+ if (!preg_match('/^(E:|W:)\d+$/', $code)) {
+ throw new Exception(
+ pht(
+ 'Unrecognized lint message code "%s". Expected a valid gJSLint'.
+ 'lint code like "%s" or "%s".',
+ $code,
+ 'E:0110',
+ 'W:0010')
+ );
+ }
+ return $code;
+ }
+
public function getLinterName() {
return 'Closure Linter';
}
@@ -29,6 +43,14 @@
return 'gjslint';
}
+ protected function getDefaultMessageSeverity($code) {
+ if (preg_match('/^W/', $code)) {
+ return ArcanistLintSeverity::SEVERITY_WARNING;
+ } else {
+ return ArcanistLintSeverity::SEVERITY_ERROR;
+ }
+ }
+
public function getInstallInstructions() {
return pht(
'Install gJSLint using `sudo easy_install http://closure-linter'.
@@ -47,8 +69,6 @@
// Each line looks like this:
// Line 46, E:0110: Line too long (87 characters).
$regex = '/^Line (\d+), (E:\d+): (.*)/';
- $severity_code = ArcanistLintSeverity::SEVERITY_ERROR;
-
$lines = phutil_split_lines($stdout, false);
$messages = array();
@@ -68,7 +88,7 @@
$message->setName($matches[2]);
$message->setCode($this->getLinterName());
$message->setDescription($matches[3]);
- $message->setSeverity($severity_code);
+ $message->setSeverity($this->getLintMessageSeverity($matches[2]));
$messages[] = $message;
}

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 21, 1:04 PM (1 d, 1 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7483380
Default Alt Text
D10690.diff (1 KB)

Event Timeline