Last active
July 20, 2017 14:20
-
-
Save blindsey/5490920 to your computer and use it in GitHub Desktop.
git pre-commit hook for puppet-lint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
EXEC=/usr/bin/puppet-lint | |
if [ -x $EXEC ]; then | |
git status -s | grep -v ^D | grep '.pp$' | awk '{print $2}' | xargs $EXEC --with-filename | |
if [ $? -ne 0 ]; then | |
echo -e "\033[38;5;148m!! Commit rejected due to puppet-lint ERROR !!\033[0m" | |
exit 1 | |
fi | |
fi | |
exit 0 |
Author
blindsey
commented
Apr 30, 2013
- gem install puppet-lint
- Copy this script into .git/hooks/pre-commit and make it executable
- Profit
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment