mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-29 02:02: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:
parent
0888b6616c
commit
fb826bbf9c
2 changed files with 17 additions and 1 deletions
|
@ -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);
|
||||
|
|
10
src/lint/linter/__tests__/xhpast/todo.lint-test
Normal file
10
src/lint/linter/__tests__/xhpast/todo.lint-test
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
// TODO: Something goes here.
|
||||
|
||||
/**
|
||||
* @todo Something else goes here.
|
||||
*/
|
||||
~~~~~~~~~~
|
||||
disabled:3:4
|
||||
disabled:6:4
|
Loading…
Reference in a new issue