Skip to content

Instantly share code, notes, and snippets.

@yanivmo
Created October 27, 2016 08:16
Show Gist options
  • Save yanivmo/9a2f47eac16383a22254b2475fb217bb to your computer and use it in GitHub Desktop.
Save yanivmo/9a2f47eac16383a22254b2475fb217bb to your computer and use it in GitHub Desktop.
Automatically detect how haimzardous your source is
#!/bin/bash
total=$(git blame $1 | wc -l)
haim=$(git blame $1 | grep -i Haim | wc -l)
if [ "$total" -eq "0" ]; then
echo "Cannot blame"
exit -1
fi
let haimzard=haim*100/total
if [ "$haimzard" -gt "0" ]; then
echo "${haimzard}% haimzardous!"
exit -1
else
echo "No haimzards detected"
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment