Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2889732
ArcanistTodoCommentXHPASTLinterRule.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
1010 B
Referenced Files
None
Subscribers
None
ArcanistTodoCommentXHPASTLinterRule.php
View Options
<?php
final
class
ArcanistTodoCommentXHPASTLinterRule
extends
ArcanistXHPASTLinterRule
{
const
ID
=
16
;
public
function
getLintName
(
)
{
return
pht
(
'TODO Comment'
)
;
}
public
function
getLintSeverity
(
)
{
return
ArcanistLintSeverity
::
SEVERITY_DISABLED
;
}
public
function
process
(
XHPASTNode
$root
)
{
$comments
=
$root
->
selectTokensOfTypes
(
array
(
'T_COMMENT'
,
'T_DOC_COMMENT'
,
)
)
;
foreach
(
$comments
as
$token
)
{
$value
=
$token
->
getValue
(
)
;
if
(
$token
->
getTypeName
(
)
===
'T_DOC_COMMENT'
)
{
$regex
=
'/(TODO|@todo)/'
;
}
else
{
$regex
=
'/TODO/'
;
}
$matches
=
null
;
$preg
=
preg_match_all
(
$regex
,
$value
,
$matches
,
PREG_OFFSET_CAPTURE
)
;
foreach
(
$matches
[
0
]
as
$match
)
{
list
(
$string
,
$offset
)
=
$match
;
$this
->
raiseLintAtOffset
(
$token
->
getOffset
(
)
+
$offset
,
pht
(
'This comment has a TODO.'
)
,
$string
)
;
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 12:33 (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1121039
Default Alt Text
ArcanistTodoCommentXHPASTLinterRule.php (1010 B)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment