Skip to content

Instantly share code, notes, and snippets.

@caius
Created May 24, 2017 10:26
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 caius/9376804af3224d2096da307ee090c91a to your computer and use it in GitHub Desktop.
Save caius/9376804af3224d2096da307ee090c91a to your computer and use it in GitHub Desktop.
overcommit validate puppet syntax
PreCommit:
PuppetValidate:
enabled: true
description: 'Validates puppet syntax'
include: '**/*.pp'
# .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