Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7187893
ArcanistLintJSONRenderer.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
913 B
Referenced Files
None
Subscribers
None
ArcanistLintJSONRenderer.php
View Options
<?php
/**
* Shows lint messages to the user.
*
* @group lint
*/
final
class
ArcanistLintJSONRenderer
extends
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
)
{
$dictionary
=
$message
->
toDictionary
();
$dictionary
[
'context'
]
=
implode
(
"
\n
"
,
array_slice
(
$data
,
max
(
1
,
$message
->
getLine
()
-
self
::
LINES_OF_CONTEXT
),
self
::
LINES_OF_CONTEXT
*
2
+
1
));
unset
(
$dictionary
[
'path'
]);
$output
[
$path
][]
=
$dictionary
;
}
return
json_encode
(
$output
).
"
\n
"
;
}
public
function
renderOkayResult
()
{
return
""
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Jul 8, 07:42 (9 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
810392
Default Alt Text
ArcanistLintJSONRenderer.php (913 B)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline
Log In to Comment