Skip to content

Instantly share code, notes, and snippets.

@DougFischer
Created August 6, 2015 20:59
Show Gist options
  • Select an option

  • Save DougFischer/12c764cf42f6c08993a0 to your computer and use it in GitHub Desktop.

Select an option

Save DougFischer/12c764cf42f6c08993a0 to your computer and use it in GitHub Desktop.
Xcode post build script to display a warning suggesting class refactors when your code has more than 600 lines.
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -and \( -path "${SRCROOT}/Pods/*" -prune -o -print0 \) | xargs -0 wc -l | awk '$1 > 600 && $2 != "total" {for(i=2;i<NF;i++){printf "%s%s", $i, " "} print $NF ":1: warning: File more than 600 lines (" $1 "), consider refactoring." }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment