Skip to content

Instantly share code, notes, and snippets.

@apg
Created December 6, 2013 17:03
Show Gist options
  • Save apg/7828349 to your computer and use it in GitHub Desktop.
Save apg/7828349 to your computer and use it in GitHub Desktop.
Never commit invalid json again! chmod +x, and add to .git/hooks/
#!/bin/sh
for n in `git status --porcelain | grep -E '^(M|A)' | grep -E '\.json$' | awk '{print $2}'`; do
if ! python -m json.tool $n > /dev/null; then
echo "$n failed to pass json sanity checks"
exit 1;
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment