Skip to content

Instantly share code, notes, and snippets.

@nelyj
Forked from michaelminter/notes.md
Created September 8, 2018 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nelyj/978108e420536b749e7f625bdf9836bc to your computer and use it in GitHub Desktop.
Save nelyj/978108e420536b749e7f625bdf9836bc to your computer and use it in GitHub Desktop.
FIXME, TODO, and OPTIMIZE code comments

You can add some special notes to your source code comments in Rails to remind you later of stuff you need to do:

class Article < ActiveRecord::Base
  # TODO add named_scopes
  # FIXME method A is broken
  # OPTIMIZE improve the code 

  has_many :comments
  ....
end

You can list these special notes with a rake task:

$ rake notes
app/models/article.rb:
  * [2] [TODO] add named_scopes
  * [3] [FIXME] method A is broken
  * [4] [OPTIMIZE] improve the code

You can also list notes of each kind individually with rake notes:todo, rake notes:fixme and rake notes:optimize.

You can even list your own, custom notes with rake notes:custom ANNOTATION=MYANNO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment