Skip to content

Instantly share code, notes, and snippets.

@barn
Created May 2, 2012 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barn/2578602 to your computer and use it in GitHub Desktop.
Save barn/2578602 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Requires bash, as it uses the [[]] syntax.
#
# If it's puppet code, lint it up.
# I we don't have puppet-lint, so just exit and leave them be.
which puppet-lint >/dev/null 2>&1 || exit
# Stuff goes here
declare -a FILES
IFS="
"
FILES=$(git diff --cached --name-only --diff-filter=ACM )
for file in ${FILES[@]}
do
if [[ $file =~ \.*.pp ]]
then
puppet-lint --with-filename "$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