Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14007673
D11320.id27191.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D11320.id27191.diff
View Options
diff --git a/src/lint/linter/ArcanistCoffeeLintLinter.php b/src/lint/linter/ArcanistCoffeeLintLinter.php
--- a/src/lint/linter/ArcanistCoffeeLintLinter.php
+++ b/src/lint/linter/ArcanistCoffeeLintLinter.php
@@ -61,7 +61,7 @@
protected function getMandatoryFlags() {
$options = array(
- '--reporter=checkstyle',
+ '--reporter=raw',
'--color=never',
);
@@ -94,32 +94,29 @@
}
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
- $report_dom = new DOMDocument();
- $ok = @$report_dom->loadXML($stdout);
+ $messages = array();
+ $output = phutil_json_decode($stdout);
- if (!$ok) {
+ // We are only linting a single file.
+ if (count($output) != 1) {
return false;
}
- $files = $report_dom->getElementsByTagName('file');
- $messages = array();
-
- foreach ($files as $file) {
- foreach ($file->getElementsByTagName('error') as $error) {
+ foreach ($output as $reports) {
+ foreach ($reports as $report) {
// Column number is not provided in the output.
// See https://github.com/clutchski/coffeelint/issues/87
$message = id(new ArcanistLintMessage())
->setPath($path)
- ->setLine($error->getAttribute('line'))
+ ->setLine($report['lineNumber'])
->setCode($this->getLinterName())
- ->setDescription(preg_replace(
- '/; context: .*$/',
- '.',
- $error->getAttribute('message')));
+ ->setName(ucwords(str_replace('_', ' ', $report['name'])))
+ ->setDescription($report['message'])
+ ->setOriginalText(idx($report, 'line'));
- switch ($error->getAttribute('severity')) {
- case 'warning':
+ switch ($report['level']) {
+ case 'warn':
$message->setSeverity(ArcanistLintSeverity::SEVERITY_WARNING);
break;
@@ -136,6 +133,10 @@
}
}
+ if ($err && !$messages) {
+ return false;
+ }
+
return $messages;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Oct 30, 9:54 AM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6754349
Default Alt Text
D11320.id27191.diff (1 KB)
Attached To
Mode
D11320: Use the `raw` formatter for `coffeelint`
Attached
Detach File
Event Timeline
Log In to Comment