siutsin
siutsin

Reputation: 1624

Generate warning for TODO and FIXME in Xcode with Cocoapods

I tried to generate warning in Xcode if there is any TODO: or FIXME: in my project using the follow bash script from HERE:

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

As I used CocoaPods, is it possible to search only with my project and it's testing but not in the Pods?

EDIT: Update sample code for .swift compatibility

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

Upvotes: 3

Views: 358

Answers (1)

HGDev
HGDev

Reputation: 2252

Try changing the line:

find "${SRCROOT}" ...

to include a forward slash and your project name after the ending curly brace. For example, if your app was called SaxGuy, it would look like this:

find "${SRCROOT}/SaxGuy" ...

Upvotes: 4

Related Questions