Ich hatte bereits puppet-lint in einem eigenen Blogeintrag vorgestellt. Noch schoener als das manuelle Aufrufen ist natuerlich das ganze als pre-commit Hook zu haben und gar nichts ins Repository rein zu lassen, was nicht den eigenen Regeln entspricht.
Folgendes ist mein pre-commit Hook:
#!/bin/bash
echo "Checking syntax with puppet-lint"
for i in $(git diff --name-only --cached | grep -E '.(pp)'); do
if [ -f "${i}" ]; then
# --no-80chars-check because of sshkey.pub and
# https://github.com/rodjek/puppet-lint/issues/70
puppet-lint --no-80chars-check --no-single_quote_string_with_variables-check --with-filename ${i}
if [ $? -ne 0 ]; then
echo "ERROR: Bad syntax, see errors above. Aborting!"
exit 1
else
echo "Nice work in: ${i} :-)"
fi
fi
done