Example of git hook for measuring team joy using code as proxy
copy commit-msg.rb to .git/hooks/commit-msg in any repository where you want to use this local commit hook.
Make sure to drop the .rb off the end of the file name when placed in the hooks directory or git will not pick it up.
Once installed, all commit messages must contain a quality rating bewtween 0 and 5 in the format of -n- where n is the rating. Rating scale is roughly:
0 - Terrible quality
1 - Very Poor quality
2 - Poor quality
3 - Good quality
4 - Very Good quality
5 - Excellent quality
git commit -m"US999999 -3- Added valid threshold check to controller"
This commit message has a rating of 3 (Good quality)
git commit -m"US999999 Added valid threshold check to controller"
This commit message has no rating and will be rejected
git commit -m"US999999 -7- Added valid threshold check to controller"
This commit message has a rating of 7, which is too high, and will be rejected
This git hook can be ignored by using the --no-verify
parameter.
git commit -m"US999999 -7- Added valid threshold check to controller" --no-verify
This commit message has a rating of 7, but the commit will be accepted because the no-verify flag will bypass the hook.