Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Never commit ruby syntax errors
#!/usr/bin/env bash
set -e
files() {
git diff --name-only --cached --full-index
}
check() {
while read file; do
filename=$(basename "$file")
extension="${filename##*.}"
if [ "rb" = $extension ]; then
if [ -f "$file" ]; then ruby -c $file >/dev/null; fi
fi
done
}
echo "Checking ruby syntax..."
files | check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.