Searching code for "TODO" comments with git grep07 Oct 2012 by Yuri Prezument
My code, like most code, tends to contain TODO/FIXME comments for things that I don't want to bother with at the time of writing them. Sometimes, these tend to pile up. A quick method of finding them is git grep:
$ git grep TODO
Today I was looking for "TODO" annotations in an old project and completely missed a couple of FIXMEs due to being too lazy to grep for them. This would have caught them:
$ git grep -e TODO -e FIXME
But that's too much typing. So why not make an alias for it?
[alias] todo = grep -n -e TODO -e FIXME -e XXX -e OPTIMIZE
$ git todo celeryconfig.py:7: # TODO: find best schedule to avoid query limits models.py:38: # FIXME: remove this method soon
Ok, that was fun. Back to work...
- On a general note - don't let TODOs and FIXMEs pile up in the first place. If it's easy to fix - fix it. If not, document it or open an issue.