Skip to content

Instantly share code, notes, and snippets.

@bchopson
Created June 2, 2016 17:16
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 bchopson/fb9e230f5e84733335f37dc143fdb299 to your computer and use it in GitHub Desktop.
Save bchopson/fb9e230f5e84733335f37dc143fdb299 to your computer and use it in GitHub Desktop.
Pre-commit hook to enforce space after function keyword
#!/bin/sh
if grep -r --include \*.js "function(" ./app
then
echo "Put a space after the function keyword!"
echo "Run the following command in app directory to fix:";
echo "find . -name \"*.js\" -print0 | xargs -0 sed -i -e 's/function(/function (/g'"
exit 1;
else
exit 0;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment