Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15403204
D11207.id26880.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D11207.id26880.diff
View Options
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
@@ -1,7 +1,7 @@
<?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 {
@@ -14,11 +14,11 @@
}
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() {
@@ -31,8 +31,10 @@
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() {
@@ -44,32 +46,21 @@
}
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;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 19, 2:12 AM (4 d, 1 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7595214
Default Alt Text
D11207.id26880.diff (2 KB)
Attached To
Mode
D11207: Various improvements for `ArcanistClosureLinter`
Attached
Detach File
Event Timeline
Log In to Comment