コードベースをスキャンしてTODOを探し、標準のWebページに表示できるリストを生成する方法はありますか。
例えば
@todo非推奨の関数remove.........(functions.php [12行目])
これは、ローカルWAMPサーバーで機能する必要があります。
Windowsプラットフォームの場合、またはPHP自体を使用したい場合は、...を使用できます。
function getTodos($path) {
$todos = array();
$items = glob(rtrim($path, '/') . '/*');
foreach($items as $item) {
if (is_file($item) AND pathinfo($item, PATHINFO_EXTENSION) == 'php') {
$fileContents = file_get_contents($item);
$tokens = token_get_all($fileContents);
foreach($tokens as $type = $token) {
if (($type == 'T_COMMENT' OR $type == 'T_ML_COMMENT')
AND preg_match_all('/^\s*(?P<todo>@todo.*?)\z/m', $token, $matches) {
$todos = array_merge($todos, $matches['todo']);
}
}
} else if (is_dir($item)) {
$todos = array_merge$($todos, getTodos($item));
continue;
}
}
return $lines;
}
私はそれをテストしていませんが、理論的には動作するはずです。:)
* nixでは、grep...を使用できます。
$ grep -r \b@todo\b ./
完璧ではありませんが(文字列内で見つかります)、十分なはずです。:)
Phpdocは、コードベースのコメントとメソッドからhtmlファイルを生成できます。また、やることなども表示されます。
PHPStorm には、すべての todo ファイルをプルアップする機能があります。私は、コミットを行う前にそれを使用します。非常に優れた機能であり、そのまま使用できます。
オープン ソース ライセンスは無料です 。 http://www.jetbrains.com/phpstorm/
他にもさまざまなライセンスが利用可能です http://www.jetbrains.com/phpstorm/buy/index.jsp
[私は Jetbrains とは提携していませんが、それを使用するのが好きな開発者です]