Turn TODOs Into Warnings With Xcode
Posted by Patrick on Thursday, August 18, 2011Thu, Aug 18, 2011

In the process of going through my game engine and refactoring a few things, I noticed a bunch of TODO: reminders that I had apparently dropped in months ago and promptly forgot about. Out of sight, out of mind.

After a quick search, I found this very helpful post by Jake Marsh for turning them (and other markers) into Xcode warnings at build time.

I refactored his snippet slightly and ended up with the following. Just drop it in as a script build phase.

find "${SRCROOT}" -type f | egrep "^.*\.($TYPES)$" | xargs egrep --with-filename --line-number --only-matching "($MATCH).*\$" | perl -p -e "s/($MATCH)/ warning: \$1/"

The advantage of all this is that I absolutely abhor warnings. Having them show up every time I build will quickly grate on my nerves until I go in and address them.