Page MenuHomePhorge

ArcanistTodoCommentXHPASTLinterRule.php
No OneTemporary

ArcanistTodoCommentXHPASTLinterRule.php

<?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

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)

Event Timeline