2024-08-20 Railsでプロジェクト内のTODOやFIXMEコメントを出すコマンド
Railsプロジェクトのコード中のTODOやFIXMEコメントを一覧で出力する bin/rails notes
が便利。
bin/rails notes
は、特定のキーワードで始まるコードコメントを検索して表示します。bin/rails notes --help
で利用法を表示できます。
Usage
$ bin/rails notes --help
Usage:
bin/rails notes
Options:
-a, [--annotations=one two three] # Filter by specific annotations, e.g. Foobar TODO
Show comments in your code annotated with FIXME, OPTIMIZE, and TODO
サンプル出力
$ bin/rails notes
app/controllers/admin/users_controller.rb:
* [ 20] [TODO] any other way to do this?
* [132] [FIXME] high priority for next deploy
lib/school.rb:
* [ 13] [OPTIMIZE] refactor this code to make it faster
* [ 17] [FIXME]
$ bin/rails notes --annotations FIXME RELEASE
app/controllers/admin/users_controller.rb:
* [101] [RELEASE] We need to look at this before next release
* [132] [FIXME] high priority for next deploy
lib/school.rb:
* [ 17] [FIXME]