Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14016795
D20541.id48986.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
D20541.id48986.diff
View Options
diff --git a/src/lint/linter/ArcanistJSHintLinter.php b/src/lint/linter/ArcanistJSHintLinter.php
--- a/src/lint/linter/ArcanistJSHintLinter.php
+++ b/src/lint/linter/ArcanistJSHintLinter.php
@@ -71,7 +71,7 @@
protected function getMandatoryFlags() {
$options = array();
- $options[] = '--reporter='.dirname(realpath(__FILE__)).'/reporter.js';
+ $options[] = '--reporter=checkstyle';
if ($this->jshintrc) {
$options[] = '--config='.$this->jshintrc;
@@ -114,28 +114,22 @@
}
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
- $errors = null;
- try {
- $errors = phutil_json_decode($stdout);
- } catch (PhutilJSONParserException $ex) {
- // Something went wrong and we can't decode the output. Exit abnormally.
- throw new PhutilProxyException(
- pht('JSHint returned unparseable output.'),
- $ex);
- }
-
+ $errors = simplexml_load_string($stdout);
$messages = array();
- foreach ($errors as $err) {
- $message = new ArcanistLintMessage();
- $message->setPath($path);
- $message->setLine(idx($err, 'line'));
- $message->setChar(idx($err, 'col'));
- $message->setCode(idx($err, 'code'));
- $message->setName('JSHint'.idx($err, 'code'));
- $message->setDescription(idx($err, 'reason'));
- $message->setSeverity($this->getLintMessageSeverity(idx($err, 'code')));
- $messages[] = $message;
+ foreach ($errors->file as $file) {
+ foreach ($file->error as $err) {
+ $code = substr($err['source'], strlen('jshint.'));
+
+ $messages[] = id(new ArcanistLintMessage())
+ ->setPath($path)
+ ->setLine((int)$err['line'])
+ ->setChar((int)$err['column'])
+ ->setCode($code)
+ ->setName('JSHint'.$code)
+ ->setDescription((string)$err['message'])
+ ->setSeverity($this->getLintMessageSeverity($code));
+ }
}
return $messages;
diff --git a/src/lint/linter/reporter.js b/src/lint/linter/reporter.js
deleted file mode 100644
--- a/src/lint/linter/reporter.js
+++ /dev/null
@@ -1,18 +0,0 @@
-module.exports = {
- reporter: function (results) {
- var report = [];
-
- results.forEach(function (result) {
- var error = result.error;
- report.push({
- 'file' : result.file,
- 'line' : error.line,
- 'col' : error.character,
- 'reason' : error.reason,
- 'code' : error.code,
- });
- });
-
- process.stdout.write(JSON.stringify(report));
- }
-};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 5, 10:43 AM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6716364
Default Alt Text
D20541.id48986.diff (2 KB)
Attached To
Mode
D20541: Use the checkstyle reporter with JSHint
Attached
Detach File
Event Timeline
Log In to Comment