puppet-doc-lint 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/bin/puppet-doc-lint +1 -1
- data/lib/puppet-doc-lint/parser.rb +2 -5
- data/lib/puppet-doc-lint/version.rb +1 -1
- data/puppet-doc-lint.gemspec +2 -2
- data/spec/manifests/nested_bullets.pp +13 -0
- data/spec/manifests/parameters_rdoc.pp +1 -0
- data/spec/runner_acceptance_spec.rb +1 -1
- data/spec/runner_results_spec.rb +62 -23
- metadata +13 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70a3379e492215be1a969178afa712b05c11e543
|
4
|
+
data.tar.gz: 03e079e6f1062f0134c62a5c405f7d5122551dba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5afa27a3e693af0a682607a823ca02591ce05a9e5408d18c443dc932f1c748df31baa7200aca597d022909ec8fd894c886501e036617c41e62387932bb4a424e
|
7
|
+
data.tar.gz: ef1b370a69ed9abe5c4549c1b4937326830512e4ed7fa6fdfc4877df99631de70f7075933a73cfb681aebd8accc5b5e87fc441148dc4fc6656d6494d0c8b0726
|
data/.travis.yml
CHANGED
data/bin/puppet-doc-lint
CHANGED
@@ -37,7 +37,7 @@ coverage = parameters_documented_total.percent_of(parameters_total) unless param
|
|
37
37
|
puts "\n\n"
|
38
38
|
puts "Number of files: #{tally}"
|
39
39
|
puts "Total variables: #{parameters_total}"
|
40
|
-
puts "Total missing variables: #{
|
40
|
+
puts "Total missing variables: #{parameters_undocumented_total}"
|
41
41
|
puts "Documented variables: #{parameters_documented_total}"
|
42
42
|
puts "Documentation coverage: #{coverage.round(2)}%"
|
43
43
|
|
@@ -3,7 +3,7 @@ class PuppetDocLint
|
|
3
3
|
|
4
4
|
def initialize(file)
|
5
5
|
# Read file and return parsed object
|
6
|
-
pparser
|
6
|
+
pparser = Puppet::Parser::Parser.new(Puppet::Node::Environment.new('production'))
|
7
7
|
if File.exists?(file)
|
8
8
|
@file = File.expand_path(file)
|
9
9
|
pparser.import(@file)
|
@@ -45,11 +45,8 @@ class PuppetDocLint
|
|
45
45
|
rdoc.parts.each do |part|
|
46
46
|
if part.respond_to?(:items)
|
47
47
|
part.items.each do |item|
|
48
|
-
# Skip rdoc items that aren't paragraphs
|
49
|
-
next unless (item.parts.to_s.scan("RDoc::Markup::Paragraph") == ["RDoc::Markup::Paragraph"])
|
50
|
-
# Documentation must be a list - if there's no label then skip
|
51
48
|
next if item.label.nil?
|
52
|
-
key = item.label.tr('^A-Za-z0-9_-', '')
|
49
|
+
key = item.label.to_s.tr('^A-Za-z0-9_-', '')
|
53
50
|
docs[key] = item.parts.first.parts
|
54
51
|
end # do item
|
55
52
|
end # endif
|
data/puppet-doc-lint.gemspec
CHANGED
@@ -20,8 +20,8 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.add_development_dependency 'rspec', '~> 2.14.1'
|
21
21
|
gem.add_development_dependency 'rake', '~> 10.1.1'
|
22
22
|
gem.add_runtime_dependency 'rdoc', '>=3.12', '<4.0'
|
23
|
-
gem.add_runtime_dependency 'facter'
|
24
|
-
gem.add_runtime_dependency 'puppet'
|
23
|
+
gem.add_runtime_dependency 'facter'
|
24
|
+
gem.add_runtime_dependency 'puppet'
|
25
25
|
gem.add_runtime_dependency 'virtus', '~> 1.0.1'
|
26
26
|
|
27
27
|
|
data/spec/runner_results_spec.rb
CHANGED
@@ -1,36 +1,75 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe PuppetDocLint::DocRunner do
|
4
|
-
file = 'spec/manifests/define_rdoc.pp'
|
5
|
-
subject { setup(file) }
|
6
4
|
|
7
|
-
|
8
|
-
subject.class.should be(Array)
|
9
|
-
subject[0].class.should be(PuppetDocLint::Result)
|
10
|
-
end
|
5
|
+
context 'define_rdoc' do
|
11
6
|
|
12
|
-
|
13
|
-
subject
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'class should be define_rdoc ' do
|
17
|
-
subject[0].class_name.should eql 'define_rdoc'
|
18
|
-
end
|
7
|
+
file = 'spec/manifests/define_rdoc.pp'
|
8
|
+
subject { setup(file) }
|
19
9
|
|
20
|
-
|
21
|
-
|
22
|
-
|
10
|
+
it 'result should be an array of PuppetDocLint::Result' do
|
11
|
+
subject.class.should be(Array)
|
12
|
+
subject[0].class.should be(PuppetDocLint::Result)
|
13
|
+
end
|
23
14
|
|
24
|
-
|
25
|
-
|
26
|
-
|
15
|
+
it 'file name should be defined' do
|
16
|
+
subject[0].file_name.should eql 'spec/manifests/define_rdoc.pp'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'class should be define_rdoc ' do
|
20
|
+
subject[0].class_name.should eql 'define_rdoc'
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'all parameters should be defined' do
|
24
|
+
subject[0].parameters.should eql ["param_one", "param_two", "param_three", "param_four"]
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'no documentation is nil' do
|
28
|
+
subject[0].no_documentation.should be_false
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'documented parameters' do
|
32
|
+
subject[0].documented_parameters.should eql ["param_one"]
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'undocumented_parameters parameters' do
|
36
|
+
subject[0].undocumented_parameters.should eql ["param_two", "param_three", "param_four"]
|
37
|
+
end
|
27
38
|
|
28
|
-
it 'documented parameters' do
|
29
|
-
subject[0].documented_parameters.should eql ["param_one"]
|
30
39
|
end
|
31
40
|
|
32
|
-
|
33
|
-
|
41
|
+
context 'define_rdoc' do
|
42
|
+
file = 'spec/manifests/nested_bullets.pp'
|
43
|
+
subject { setup(file) }
|
44
|
+
|
45
|
+
it 'result should be an array of PuppetDocLint::Result' do
|
46
|
+
subject.class.should be(Array)
|
47
|
+
subject[0].class.should be(PuppetDocLint::Result)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'file name should be defined' do
|
51
|
+
subject[0].file_name.should eql "spec/manifests/nested_bullets.pp"
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'class should be foo' do
|
55
|
+
subject[0].class_name.should eql 'foo'
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'all parameters should be defined' do
|
59
|
+
subject[0].parameters.should eql ["ensure"]
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'no documentation is nil' do
|
63
|
+
subject[0].no_documentation.should be_false
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'documented parameters' do
|
67
|
+
subject[0].documented_parameters.should eql ["ensure"]
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'undocumented_parameters parameters' do
|
71
|
+
subject[0].undocumented_parameters.should eql []
|
72
|
+
end
|
34
73
|
end
|
35
74
|
|
36
75
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-doc-lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Souter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -62,30 +62,30 @@ dependencies:
|
|
62
62
|
name: facter
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - '>='
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '0'
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - '>='
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: puppet
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- -
|
79
|
+
- - '>='
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
81
|
+
version: '0'
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- -
|
86
|
+
- - '>='
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
88
|
+
version: '0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: virtus
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- puppet-doc-lint.gemspec
|
131
131
|
- spec/manifests/define_nordoc.pp
|
132
132
|
- spec/manifests/define_rdoc.pp
|
133
|
+
- spec/manifests/nested_bullets.pp
|
133
134
|
- spec/manifests/noclass.pp
|
134
135
|
- spec/manifests/noparameters_nordoc.pp
|
135
136
|
- spec/manifests/noparameters_rdoc.pp
|
@@ -157,13 +158,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
158
|
version: '0'
|
158
159
|
requirements: []
|
159
160
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.
|
161
|
+
rubygems_version: 2.4.5
|
161
162
|
signing_key:
|
162
163
|
specification_version: 4
|
163
164
|
summary: Doc Parser for Puppet Modules. Returns Information about documentation.
|
164
165
|
test_files:
|
165
166
|
- spec/manifests/define_nordoc.pp
|
166
167
|
- spec/manifests/define_rdoc.pp
|
168
|
+
- spec/manifests/nested_bullets.pp
|
167
169
|
- spec/manifests/noclass.pp
|
168
170
|
- spec/manifests/noparameters_nordoc.pp
|
169
171
|
- spec/manifests/noparameters_rdoc.pp
|