Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2984332
ArcanistCheckstyleXMLLintRenderer.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
1 KB
Referenced Files
None
Subscribers
None
ArcanistCheckstyleXMLLintRenderer.php
View Options
<?php
final
class
ArcanistCheckstyleXMLLintRenderer
extends
ArcanistLintRenderer
{
const
RENDERERKEY
=
'xml'
;
private
$writer
;
public
function
__construct
(
)
{
$this
->
writer
=
new
XMLWriter
(
)
;
$this
->
writer
->
openMemory
(
)
;
$this
->
writer
->
setIndent
(
true
)
;
$this
->
writer
->
setIndentString
(
' '
)
;
}
public
function
willRenderResults
(
)
{
$this
->
writer
->
startDocument
(
'1.0'
,
'UTF-8'
)
;
$this
->
writer
->
startElement
(
'checkstyle'
)
;
$this
->
writer
->
writeAttribute
(
'version'
,
'4.3'
)
;
$this
->
writeOut
(
$this
->
writer
->
flush
(
)
)
;
}
public
function
renderLintResult
(
ArcanistLintResult
$result
)
{
$this
->
writer
->
startElement
(
'file'
)
;
$this
->
writer
->
writeAttribute
(
'name'
,
$result
->
getPath
(
)
)
;
foreach
(
$result
->
getMessages
(
)
as
$message
)
{
$this
->
writer
->
startElement
(
'error'
)
;
$this
->
writer
->
writeAttribute
(
'line'
,
$message
->
getLine
(
)
)
;
$this
->
writer
->
writeAttribute
(
'column'
,
$message
->
getChar
(
)
)
;
$this
->
writer
->
writeAttribute
(
'severity'
,
$this
->
getStringForSeverity
(
$message
->
getSeverity
(
)
)
)
;
$this
->
writer
->
writeAttribute
(
'message'
,
$message
->
getDescription
(
)
)
;
$this
->
writer
->
writeAttribute
(
'source'
,
$message
->
getCode
(
)
)
;
$this
->
writer
->
endElement
(
)
;
}
$this
->
writer
->
endElement
(
)
;
$this
->
writeOut
(
$this
->
writer
->
flush
(
)
)
;
}
public
function
didRenderResults
(
)
{
$this
->
writer
->
endElement
(
)
;
$this
->
writer
->
endDocument
(
)
;
$this
->
writeOut
(
$this
->
writer
->
flush
(
)
)
;
}
private
function
getStringForSeverity
(
$severity
)
{
switch
(
$severity
)
{
case
ArcanistLintSeverity
::
SEVERITY_ADVICE
:
return
'info'
;
case
ArcanistLintSeverity
::
SEVERITY_AUTOFIX
:
return
'info'
;
case
ArcanistLintSeverity
::
SEVERITY_WARNING
:
return
'warning'
;
case
ArcanistLintSeverity
::
SEVERITY_ERROR
:
return
'error'
;
case
ArcanistLintSeverity
::
SEVERITY_DISABLED
:
return
'ignore'
;
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Feb 20, 23:48 (3 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1163970
Default Alt Text
ArcanistCheckstyleXMLLintRenderer.php (1 KB)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment