Page MenuHomeSealhub

No OneTemporary

diff --git a/src/lint/linter/ArcanistClosureLinter.php b/src/lint/linter/ArcanistClosureLinter.php
index 89097382..d437f3b6 100644
--- a/src/lint/linter/ArcanistClosureLinter.php
+++ b/src/lint/linter/ArcanistClosureLinter.php
@@ -1,79 +1,70 @@
<?php
/**
- * Uses gJSLint to detect errors and potential problems in JavaScript code.
+ * Uses `gjslint` to detect errors and potential problems in JavaScript code.
*/
final class ArcanistClosureLinter extends ArcanistExternalLinter {
public function getInfoName() {
return 'Closure Linter';
}
public function getInfoURI() {
return 'https://developers.google.com/closure/utilities/';
}
public function getInfoDescription() {
- return pht("Uses Google's Closure Linter to check Javascript code.");
+ return pht("Uses Google's Closure Linter to check JavaScript code.");
}
public function getLinterName() {
- return 'Closure Linter';
+ return 'GJSLINT';
}
public function getLinterConfigurationName() {
return 'gjslint';
}
public function getDefaultBinary() {
return 'gjslint';
}
public function getInstallInstructions() {
return pht(
- 'Install gJSLint using `sudo easy_install http://closure-linter'.
- '.googlecode.com/files/closure_linter-latest.tar.gz`');
+ 'Install %s using `%s`.',
+ 'gjslint',
+ 'sudo easy_install http://closure-linter.googlecode.com/'.
+ 'files/closure_linter-latest.tar.gz');
}
public function shouldExpectCommandErrors() {
return true;
}
public function supportsReadDataFromStdin() {
return false;
}
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
- // 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();
+
foreach ($lines as $line) {
- $line = trim($line);
$matches = null;
- if (!preg_match($regex, $line, $matches)) {
+ if (!preg_match('/^Line (\d+), E:(\d+): (.*)/', $line, $matches)) {
continue;
}
- foreach ($matches as $key => $match) {
- $matches[$key] = trim($match);
- }
-
- $message = new ArcanistLintMessage();
- $message->setPath($path);
- $message->setLine($matches[1]);
- $message->setName($matches[2]);
- $message->setCode($this->getLinterName());
- $message->setDescription($matches[3]);
- $message->setSeverity($severity_code);
+ $message = id(new ArcanistLintMessage())
+ ->setPath($path)
+ ->setLine($matches[1])
+ ->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR)
+ ->setCode($this->getLinterName().$matches[2])
+ ->setDescription($matches[3]);
$messages[] = $message;
}
return $messages;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sat, Oct 11, 06:55 (6 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
983919
Default Alt Text
(2 KB)

Event Timeline