Created
May 24, 2017 10:26
-
-
Save caius/9376804af3224d2096da307ee090c91a to your computer and use it in GitHub Desktop.
overcommit validate puppet syntax
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
PreCommit: | |
PuppetValidate: | |
enabled: true | |
description: 'Validates puppet syntax' | |
include: '**/*.pp' |
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
# .git-hooks/pre_commit/puppet_validate.rb | |
module Overcommit::Hook::PreCommit | |
class PuppetValidate < Base | |
def run | |
errors = [] | |
result = execute(%w(puppet parser validate), :args => applicable_files) | |
return :pass if result.success? | |
[:fail, result.stderr] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment