Cocos2D Central: XCode TODO's and FIXME's - Cocos2D Central

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

XCode TODO's and FIXME's Rate Topic: ***** 1 Votes

#1 User is offline   Tim 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 40
  • Joined: 24-January 11

Posted 09 February 2011 - 10:08 AM

In XCode Is there any way to get a list of the TODOs or FIXMEs you might have placed into comments other than scanning through the function list on each file individually? I'm used to doing work on Eclipse where it kept a task list of those kinds of comments, plus you could configure special tags for other situations. If doing TODOs and FIXMEs are not the desirable solution to noting such issues - what process do you guys do to keep track of the loose ends that need to be tied up later?
0

#2 User is offline   Tim 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 40
  • Joined: 24-January 11

Posted 09 February 2011 - 10:51 PM

Found a nice solution after Googling around for a bit:

1.) Go to: Project -> New Build Phase -> New Run Script Build Phase
2.) In the window that pops up place this in the script section:
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/"


Make sure you don't have any spaces in your path (my projects folder had a space and it broke the find). What this script does is look for any TODO: or FIXME: comments in your code and flags them as a warning whenever you build your project. Then you can click on those warnings and get to the file in question. This will save time in trying to find these little comments that I've peppered around the place. Maybe someone else will find it useful.

If you want to remove the script just expand your Targets list, choose the Run Script option and delete it or modify it as necessary. If you're OCD and hate to have warnings in your build results and you use FIXMEs/TODOs then this script might be annoying. Or maybe thats the point. *shrug*

--Tim
0

#3 User is offline   MartinH. 

  • Fan
  • PipPipPipPipPip
  • Group: Members
  • Posts: 108
  • Joined: 08-December 10

Posted 10 February 2011 - 06:02 AM

Thanks for the advice. I think there is also another way of doing this where the fixme is implemented using pragma marks which show up in that list of methods, defines, pragma marks etc. that you can browse per file. I'm sorry, I don't know what it's called. Probably less easy to find in big projects but also less annoying?!
0

#4 User is offline   Tim 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 40
  • Joined: 24-January 11

Posted 10 February 2011 - 08:27 AM

Quote

I think there is also another way of doing this where the fixme is implemented using pragma marks which show up in that list of methods, defines, pragma marks etc.


Yeah, just use a normal comment like // TODO: or // FIXME: and it'll show up in the function list, but like you say, when the project size increases and you're working towards playable rather than complete - there's bound to be a number of places that need to be worked on and clicking on each file to find these comments is tedious. In my case I also use my TODO list as a mental notebook of future features. I could keep track of that stuff in something like Evernote but what I don't need is one more app to fiddle with and organize.
0

#5 User is offline   Jelle 

  • New Here
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 14-April 12

Posted 14 April 2012 - 03:22 AM

View PostTim, on 09 February 2011 - 10:51 PM, said:


1.) Go to: Project -> New Build Phase -> New Run Script Build Phase
2.) In the window that pops up place this in the script section:
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/"




Super! Thanks Tim, this works like a charm!
0

#6 User is offline   Averett 

  • Enthusiast
  • PipPipPipPip
  • Group: Members
  • Posts: 55
  • Joined: 07-December 11

Posted 4 weeks ago

Thanks Tim -- this is GOLD!
0

#7 User is offline   Vramin 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 32
  • Joined: 21-August 11

Posted 4 weeks ago

This does work a treat. Thanks for the tip!

If you're using box2d you might want to extend the regex so it will search .m and .mm files:

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

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users