-
-
Save aussielunix/3022800 to your computer and use it in GitHub Desktop.
This file contains 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
# Variables goes hither | |
declare -a FILES | |
IFS=" | |
" | |
FILES=$(git diff --cached --name-only --diff-filter=ACM ) | |
# I we don't have puppet-lint, so just exit and leave them be. | |
which puppet-lint >/dev/null 2>&1 || exit | |
# I we don't have puppet, so just exit and leave them be. | |
which puppet >/dev/null 2>&1 || exit | |
for file in ${FILES[@]} | |
do | |
if [[ $file =~ \.*.pp$ ]] | |
then | |
puppet-lint --fail-on-warnings --no-80chars-check --with-filename "$file" | |
RC=$? | |
if [ $RC -ne 0 ] | |
then | |
exit $RC | |
fi | |
puppet parser validate "$file" | |
RC=$? | |
if [ $RC -ne 0 ] | |
then | |
exit $RC | |
fi | |
fi | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment