LoginSignup
1
0

More than 5 years have passed since last update.

rails notesを使ってrailsプロジェクトにコメントを残す

Posted at

いつか直すぞ

railsで現ブランチではなくて、別ブランチで加筆・修正する場合にコメントアウトでメモを残す場合ありますよね?
※もしくは未来の誰かに託す場合...w
その際に、“OPTIMIZE”, “FIXME”, “TODO”で書いておくと良いよって話です。

Railsガイドによると

bin/rails notesは、コードのコメントからFIXME、OPTIMIZE、TODOで始まる行を探し出して表示します (訳注: [FIXME]のように[から始まるものはヒットしません)。検索対象となるファイルの拡張子は.builder、.rb、.rake、.yml、.yaml、.ruby、.css、.js、.erbで、デフォルトのアノテーション以外に独自のアノテーションも使用できます。

Railsガイドより

app/controllers/admin/users_controller.rb
# TODO: any other way to do this?
console
$ bin/rails notes
(in /home/foobar/commandsapp)
app/controllers/admin/users_controller.rb:
  * [ 20] [TODO] any other way to do this?
  * [132] [FIXME] high priority for next deploy

app/models/school.rb:
  * [ 13] [OPTIMIZE] refactor this code to make it faster
  * [ 17] [FIXME]

実際の表示

スクリーンショット 2018-12-06 16.46.00.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0