def define(args, &task_block)
desc 'Run puppet-lint'
task_block.call(*[self, args].slice(0, task_block.arity)) if task_block
task @name do
PuppetLint::OptParser.build
Array(@disable_checks).each do |check|
PuppetLint.configuration.send("disable_#{check}")
end
%w{with_filename fail_on_warnings error_level log_format with_context fix show_ignored}.each do |config|
value = instance_variable_get("@#{config}")
PuppetLint.configuration.send("#{config}=".to_sym, value) unless value.nil?
end
RakeFileUtils.send(:verbose, true) do
linter = PuppetLint.new
matched_files = FileList[@pattern]
matched_files = matched_files.exclude(*@ignore_paths)
matched_files.to_a.each do |puppet_file|
linter.file = puppet_file
linter.run
linter.print_problems
end
abort if linter.errors? || (
linter.warnings? && PuppetLint.configuration.fail_on_warnings
)
end
end
end