Sha256: db2e3544edc7e55be7556519bb958c8ade9bc477898f13ef802f84a40aad57e4
Contents?: true
Size: 639 Bytes
Versions: 28
Compression:
Stored size: 639 Bytes
Contents
module Overcommit::Hook::PreCommit # Runs 'puppet-lint' against any modified Puppet files. # # @see http://puppet-lint.com/ class PuppetLint < Base MESSAGE_REGEX = /(?<file>(?:\w:)?.+):(?<line>\d+):\d+:(?<type>\w+)/ MESSAGE_TYPE_CATEGORIZER = lambda do |type| type == 'ERROR' ? :error : :warning end def run result = execute(command, args: applicable_files) output = result.stdout.chomp.gsub(/^"|"$/, '') return :pass if result.success? && output.empty? extract_messages( output.split("\n"), MESSAGE_REGEX, MESSAGE_TYPE_CATEGORIZER ) end end end
Version data entries
28 entries across 26 versions & 2 rubygems