Skip to content

Instantly share code, notes, and snippets.

@bs-github
Created June 29, 2012 07:50
Show Gist options
  • Save bs-github/3016543 to your computer and use it in GitHub Desktop.
Save bs-github/3016543 to your computer and use it in GitHub Desktop.
# 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