Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2890861
ArcanistJSONLintRenderer.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
835 B
Referenced Files
None
Subscribers
None
ArcanistJSONLintRenderer.php
View Options
<?php
final
class
ArcanistJSONLintRenderer
extends
ArcanistLintRenderer
{
const
RENDERERKEY
=
'json'
;
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
;
}
$this
->
writeOut
(
json_encode
(
$output
)
.
"\n"
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 14:14 (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1113747
Default Alt Text
ArcanistJSONLintRenderer.php (835 B)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment