22 Aug 2010, 2:59pm
Ruby on Rails: annotations productivity rake tasks todo
by bseanvt

leave a comment
Ruby on Rails: annotations productivity rake tasks todo
by bseanvt
leave a comment
TODO and Custom Annotations in Rails Applications
While writing software it’s common to leave comments for your future self. For instance, if you have written some code but realize that it should be refactored to be more efficient, you may place something along the lines of “TODO: change active record find method and replace w/ a custom sql select finder “. With rails, if you follow this convention, you can get a list of your annotations with a rake task.
rake notes:todo
which will print out the file where the the todo was found along with the line number and the comment…
app/controllers/application_controller.rb: * [ 8] fix me
Rails defines several other annotation types for you
rake notes # Enumerate all annotations rake notes:fixme # Enumerate all FIXME annotations rake notes:optimize # Enumerate all OPTIMIZE annotations rake notes:todo # Enumerate all TODO annotations
And you also may define your own
# SEAN: please rewrite this method to query only chunky bacon
you may find all instances of “SEAN” by running
rake notes:custom ANNOTATION=SEAN


