Back to Mobile View

Skip to Content

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

© 2014 AOL Inc. All Rights Reserved.