From: Joshua Spence Date: Tue, 4 Mar 2014 19:03:09 +0000 (-0800) Subject: Correctly identify `@todo` comments as TODOs. X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=fb826bbf9cf05604ddf817e1acb8dda79a804242;p=arcanist.git 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 --- diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php index 2e89bc35..9cf651d0 100644 --- a/src/lint/linter/ArcanistXHPASTLinter.php +++ b/src/lint/linter/ArcanistXHPASTLinter.php @@ -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); diff --git a/src/lint/linter/__tests__/xhpast/todo.lint-test b/src/lint/linter/__tests__/xhpast/todo.lint-test new file mode 100644 index 00000000..4e7be6dd --- /dev/null +++ b/src/lint/linter/__tests__/xhpast/todo.lint-test @@ -0,0 +1,10 @@ +