Sha256: 7a71d016d91d6f69020c44fabf1a123328de1d30464d43d4a8f95a5fe4a68b4c

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 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_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.1.1 bin/puppet-doc-lint
puppet-doc-lint-0.1.0 bin/puppet-doc-lint