DevJuice: Adding warnings for TODO and FIXME comments

Sponsored Links

Erica Sadun
July 27th, 2013
DevJuice: Adding warnings for TODO and FIXME comments

DevJuice Adding warnings for TODO and FIXME comments

A clever post from deallocatedobjects cropped up on IRC on Friday, and I thought I'd share its wisdom. The post discusses how you can add a custom build phase to automatically show TODO and FIXME comments as warnings in your Xcode 4 (and later) projects.

It takes very little work. Select a target and choose Editor > Add Build Phase > Add Run Script Build Phase. Paste the following bash script in:

KEYWORDS="TODO:|FIXME:|\?\?\?:|\!\!\!:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/"

According to the write-up, credit goes to "Tim" on the Cocos2D forums.

Thanks, swillits

All products recommended by Engadget are selected by our editorial team, independent of our parent company. Some of our stories include affiliate links. If you buy something through one of these links, we may earn an affiliate commission.
Popular on Engadget