Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22415856
ArcanistTodoCommentXHPASTLinterRule.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
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
Sat, Nov 28, 01:29 (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1208989
Default Alt Text
ArcanistTodoCommentXHPASTLinterRule.php (1010 B)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline