Skip to content

Instantly share code, notes, and snippets.

@cmyr
Created January 9, 2015 17:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmyr/1c1c6fe52d6fa57034a0 to your computer and use it in GitHub Desktop.
Save cmyr/1c1c6fe52d6fa57034a0 to your computer and use it in GitHub Desktop.
Compiler warnings for FIXME:
#!/bin/bash
WARNINGTAGS="FIXME:|\?\?\?:"
ERRORTAGS="\!\!\!:"
find "${SRCROOT}" \( -name "*.swift" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($WARNINGTAGS).*\$" | perl -p -e "s/($WARNINGTAGS)/ warning: \$1/"
if [ "${CONFIGURATION}" = "Release" ]
then
find "${SRCROOT}" \( -name "*.swift" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($ERRORTAGS).*\$" | perl -p -e "s/($ERRORTAGS)/ error: \$1/"
else
find "${SRCROOT}" \( -name "*.swift" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($ERRORTAGS).*\$" | perl -p -e "s/($ERRORTAGS)/ warning: \$1/"
fi
@cmyr
Copy link
Author

cmyr commented Jan 9, 2015

This makes 'FIXME:, '???:' and '!!!:' into compiler warnings on build. '!!!:' is a compiler error if building for release.

'TODO:' is ignored in this script, for historical reasons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment