Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dominik-hadl
Created February 2, 2017 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dominik-hadl/2df890a021ada999bda383b8413c9473 to your computer and use it in GitHub Desktop.
Save dominik-hadl/2df890a021ada999bda383b8413c9473 to your computer and use it in GitHub Desktop.
A script meant to be used as Xcode build phase to detect todo and fixme and output warnings and errors.
TODO_PROJECT_NAME="YourProject"
if [ $CONFIGURATION = "Release" ]; then
TAGS="FIXME"
find "${SRCROOT}/${TODO_PROJECT_NAME}" \( -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ error: \$1/"
TAGS="TODO"
find "${SRCROOT}/${TODO_PROJECT_NAME}" \( -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/"
else
TAGS="FIXME|TODO"
find "${SRCROOT}/${TODO_PROJECT_NAME}" \( -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment