Sha256: d5801c27a4e041b5507859744fb91dba2db23e4a7f394d9880171b9209c0185e

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

#!/usr/bin/env ruby

require 'puppet-doc-lint'

abort 'puppet-doc-lint: no arguments given ' if ARGV[0].nil?

runner = PuppetDocLint::Runner.new

path = ARGV[0]
if File.directory?(path)
  puppet_files = Dir.glob("#{path}/**/*.pp")
  puts "Puppet docs to be checked: #{puppet_files}"
  results = runner.run(puppet_files)
else
  results = runner.run(ARGV)
end

parameters_total = 0
parameters_documented_total = 0
parameters_undocumented_total = 0
parameters_missing_total = 0
tally = 0

results.each do |result| 
  tally = tally + 1
  result.result_report
  parameters_undocumented_total = parameters_undocumented_total + result.undocumented_parameters.size
  parameters_total = parameters_total + result.parameters.size
  parameters_documented_total = parameters_documented_total + result.documented_parameters.size 
  parameters_missing_total = parameters_missing_total + result.documented_parameter_no_assignment.size 
end 

coverage = 100

coverage = parameters_documented_total.percent_of(parameters_total) unless parameters_total == 0

puts "\n\n"
puts "Number of files: #{tally}"
puts "Total variables: #{parameters_total}"
puts "Total missing variables: #{parameters_undocumented_total}"
puts "Documented variables: #{parameters_documented_total}"
puts "Documentation coverage: #{coverage.round(2)}%"

if (parameters_missing_total + parameters_undocumented_total) > 0
  puts "Issues found!".bold.green.bg_red
  exit 1
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puppet-doc-lint-0.3.0 bin/puppet-doc-lint
puppet-doc-lint-0.2.0 bin/puppet-doc-lint