1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-10 00:42:40 +01:00

Correctly identify @todo comments as TODOs.

Summary: Allow `@todo` comments to be linted as TODOs as well as `TODO` comments.

Test Plan: I added a new test case (`todo.lint-test`)

Reviewers: #blessed_reviewers, epriestley

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Differential Revision: https://secure.phabricator.com/D8389
This commit is contained in:
Joshua Spence 2014-03-04 11:03:09 -08:00 committed by epriestley
parent 0888b6616c
commit fb826bbf9c
2 changed files with 17 additions and 1 deletions

View file

@ -2036,9 +2036,15 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
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(
'/TODO/',
$regex,
$value,
$matches,
PREG_OFFSET_CAPTURE);

View file

@ -0,0 +1,10 @@
<?php
// TODO: Something goes here.
/**
* @todo Something else goes here.
*/
~~~~~~~~~~
disabled:3:4
disabled:6:4