puppet-lint-param-docs 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cf77c26f657156fad03044435a16d3dbe003717
|
4
|
+
data.tar.gz: fe657a095d1febeb3edc1312d634779c0c97c7ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4065e1c26034d49c04f471f3e4621cf615c397116d337a8d9108ce59b94e40ea6a4620bc1ed5e625cf3b0ba9066a3f18bbb023dfe7e6adc6a72b12f9ddfa4ef
|
7
|
+
data.tar.gz: 7e63d27aacb10ffb8f7c5964b712545a6c2eefb44e4bf9d8143be0ac510dcadde74f016f26b8d5dd786ab00eff002ec5645256b5dd3db99e88c6d9dad220529b
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ default behaviour is to throw an error when a parameter is undocumented.
|
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
|
-
To use this plugin, add the following
|
11
|
+
To use this plugin, add the following line to the Gemfile in your Puppet code
|
12
12
|
base and run `bundle install`.
|
13
13
|
|
14
14
|
```ruby
|
@@ -7,7 +7,10 @@ PuppetLint.new_check(:parameter_documentation) do
|
|
7
7
|
tokens[0..klass[:start]].reverse_each do |dtok|
|
8
8
|
next if [:CLASS, :NEWLINE, :WHITESPACE, :INDENT].include?(dtok.type)
|
9
9
|
if [:COMMENT, :MLCOMMENT, :SLASH_COMMENT].include?(dtok.type)
|
10
|
-
|
10
|
+
if dtok.value =~ /\A\s*\[\*([a-zA-Z0-9_]+)\*\]/ or
|
11
|
+
dtok.value =~ /\A\s*\$([a-zA-Z0-9_]+)::/
|
12
|
+
doc_params << $1
|
13
|
+
end
|
11
14
|
else
|
12
15
|
break
|
13
16
|
end
|
@@ -44,7 +44,7 @@ class foreman (
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
context 'class missing documentation for a parameter' do
|
47
|
+
context 'class missing documentation ($bar::) for a parameter' do
|
48
48
|
let(:code) do
|
49
49
|
<<-EOS.gsub(/^\s+/, '')
|
50
50
|
# Example class
|
@@ -66,7 +66,29 @@ class foreman (
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
context 'class missing documentation for a
|
69
|
+
context 'class missing documentation ([*bar*]) for a parameter' do
|
70
|
+
let(:code) do
|
71
|
+
<<-EOS.gsub(/^\s+/, '')
|
72
|
+
# Example class
|
73
|
+
#
|
74
|
+
# === Parameters:
|
75
|
+
#
|
76
|
+
# [*bar*] example
|
77
|
+
#
|
78
|
+
class example($foo, $bar) { }
|
79
|
+
EOS
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'should detect a single problem' do
|
83
|
+
expect(problems).to have(1).problem
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'should create a warning' do
|
87
|
+
expect(problems).to contain_warning(msg % :foo).on_line(7).in_column(15)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
context 'class missing documentation ($bar::) for a second parameter' do
|
70
92
|
let(:code) do
|
71
93
|
<<-EOS.gsub(/^\s+/, '')
|
72
94
|
# Example class
|
@@ -89,7 +111,30 @@ class foreman (
|
|
89
111
|
end
|
90
112
|
end
|
91
113
|
|
92
|
-
context 'class
|
114
|
+
context 'class missing documentation ([*bar*]) for a second parameter' do
|
115
|
+
let(:code) do
|
116
|
+
<<-EOS.gsub(/^\s+/, '')
|
117
|
+
# Example class
|
118
|
+
#
|
119
|
+
# === Parameters:
|
120
|
+
#
|
121
|
+
# [*bar*] example
|
122
|
+
#
|
123
|
+
class example($foo, $bar, $baz) { }
|
124
|
+
EOS
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'should detect two problem' do
|
128
|
+
expect(problems).to have(2).problems
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'should create two warnings' do
|
132
|
+
expect(problems).to contain_warning(msg % :foo).on_line(7).in_column(15)
|
133
|
+
expect(problems).to contain_warning(msg % :baz).on_line(7).in_column(27)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
context 'class with all parameters documented ($foo::)' do
|
93
138
|
let(:code) do
|
94
139
|
<<-EOS
|
95
140
|
# Example class
|
@@ -107,6 +152,24 @@ class foreman (
|
|
107
152
|
end
|
108
153
|
end
|
109
154
|
|
155
|
+
context 'class with all parameters documented ([*foo*])' do
|
156
|
+
let(:code) do
|
157
|
+
<<-EOS
|
158
|
+
# Example class
|
159
|
+
#
|
160
|
+
# === Parameters:
|
161
|
+
#
|
162
|
+
# [*foo*] example
|
163
|
+
#
|
164
|
+
class example($foo) { }
|
165
|
+
EOS
|
166
|
+
end
|
167
|
+
|
168
|
+
it 'should not detect any problems' do
|
169
|
+
expect(problems).to have(0).problems
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
110
173
|
context 'class without parameters' do
|
111
174
|
let(:code) { 'class example { }' }
|
112
175
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-lint-param-docs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominic Cleal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puppet-lint
|