Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22422069
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/lint/renderer/ArcanistLintJSONRenderer.php b/src/lint/renderer/ArcanistLintJSONRenderer.php
index 423845ec..3ee744a4 100644
--- a/src/lint/renderer/ArcanistLintJSONRenderer.php
+++ b/src/lint/renderer/ArcanistLintJSONRenderer.php
@@ -1,57 +1,57 @@
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Shows lint messages to the user.
*
* @group lint
*/
final class ArcanistLintJSONRenderer implements ArcanistLintRenderer {
const LINES_OF_CONTEXT = 3;
public function renderLintResult(ArcanistLintResult $result) {
$messages = $result->getMessages();
$path = $result->getPath();
$data = explode("\n", $result->getData());
array_unshift($data, ''); // make the line numbers work as array indices
$output = array($path => array());
foreach ($messages as $message) {
$output[$path][] = array(
'code' => $message->getCode(),
'name' => $message->getName(),
'severity' => $message->getSeverity(),
'line' => $message->getLine(),
'char' => $message->getChar(),
'context' => implode("\n", array_slice(
$data,
- $message->getLine() - self::LINES_OF_CONTEXT,
+ max(1, $message->getLine() - self::LINES_OF_CONTEXT),
self::LINES_OF_CONTEXT * 2 + 1
)),
'description' => $message->getDescription(),
);
}
return json_encode($output)."\n";
}
public function renderOkayResult() {
return "";
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Nov 28, 03:16 (53 m, 53 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1225903
Default Alt Text
(2 KB)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline