puppet-lint-param-docs 1.7.6 → 2.0.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
  SHA256:
3
- metadata.gz: 26491f65ee561c24b8246bccf4793d451e967aa7b40796a1dfaef59cbf959de4
4
- data.tar.gz: 74fb61891a78bf720e76ab591ecd18ee4f1ba16b8eb3e57ffac0e7739635d991
3
+ metadata.gz: d2e5609d6315d0159a0cc595bcaea36fddb2e9df1323a49dee0ed53561c0dcb9
4
+ data.tar.gz: 7ef40b3020f49bda2bc7a15fdb3f8c4a0b1f46bff7dbb6719cfc7cb77e5f71ed
5
5
  SHA512:
6
- metadata.gz: 58c68e3b29fa294718ba1a43b86f8e9280c039fd94d422abd663f20f340e3fb6eede037b0a8df48553a5b1aaa179b537f82bd5c8499233c53c018e1aa7d5d647
7
- data.tar.gz: 18ffb5c2dbdba005d56ead040efbdfbd0c5eec3142322338f1641e1847d62491cd71d817b4de67a417d2d1675aba2b3c5366f26867f6fc6734c564cd7733f8cb
6
+ metadata.gz: 417d3b28eb4f28f5d5b43b136402055f4753e6b8e0b3645040870e60496e426639ef401df261747983160b278ff640c175f860f8f417f2ac0077eadacda478ea
7
+ data.tar.gz: 6120cef1c8ef2d620c4fe2f21c1acac9385a7f97b574f1d600498a9ed320b037ac7f23ec97a4aa2f7e4fb2acb1a410bab529f2e744bf3db258731cdc348fa957
@@ -1,7 +1,7 @@
1
1
  PuppetLint.new_check(:parameter_documentation) do
2
2
  def check
3
- allowed_styles = PuppetLint.configuration.docs_allowed_styles || ['doc', 'kafo', 'strings']
4
- allowed_styles = [ allowed_styles ].flatten
3
+ allowed_styles = PuppetLint.configuration.docs_allowed_styles || %w[doc kafo strings]
4
+ allowed_styles = [allowed_styles].flatten
5
5
 
6
6
  class_indexes.concat(defined_type_indexes).each do |idx|
7
7
  doc_params = {}
@@ -9,25 +9,26 @@ PuppetLint.new_check(:parameter_documentation) do
9
9
  doc_params_duplicates = Hash.new { |hash, key| hash[key] = [doc_params[key]] }
10
10
  is_private = false
11
11
  tokens[0..idx[:start]].reverse_each do |dtok|
12
- next if [:CLASS, :DEFINE, :NEWLINE, :WHITESPACE, :INDENT].include?(dtok.type)
13
- if dtok.type == :COMMENT
14
- if dtok.value =~ /\A\s*@api +private\s*$/
15
- is_private = true
16
- next
17
- end
12
+ next if %i[CLASS DEFINE NEWLINE WHITESPACE INDENT].include?(dtok.type)
18
13
 
19
- style = detect_style(dtok)
20
- # not a doc parameter if style has not been detected
21
- next if style[0].nil?
22
-
23
- parameter = style[2]
24
- parameter = 'name/title' if idx[:type] == :DEFINE && ['name','title'].include?(parameter)
25
- if doc_params.include? parameter
26
- doc_params_duplicates[parameter] << dtok
27
- else
28
- doc_params[parameter] = dtok
29
- doc_params_styles[parameter] = style[0]
30
- end
14
+ next unless dtok.type == :COMMENT
15
+
16
+ if /\A\s*@api +private\s*$/.match?(dtok.value)
17
+ is_private = true
18
+ next
19
+ end
20
+
21
+ style = detect_style(dtok)
22
+ # not a doc parameter if style has not been detected
23
+ next if style[0].nil?
24
+
25
+ parameter = style[2]
26
+ parameter = 'name/title' if idx[:type] == :DEFINE && %w[name title].include?(parameter)
27
+ if doc_params.include? parameter
28
+ doc_params_duplicates[parameter] << dtok
29
+ else
30
+ doc_params[parameter] = dtok
31
+ doc_params_styles[parameter] = style[0]
31
32
  end
32
33
  end
33
34
 
@@ -36,11 +37,11 @@ PuppetLint.new_check(:parameter_documentation) do
36
37
  # warn about duplicates
37
38
  doc_params_duplicates.each do |parameter, tokens|
38
39
  tokens.each do |token|
39
- notify :warning, {
40
- :message => "Duplicate #{type_str(idx)} parameter documentation for #{idx[:name_token].value}::#{parameter}",
41
- :line => token.line,
42
- :column => token.column + token.value.match(/\A\s*(@param\s*)?/)[0].length + 1 # `+ 1` is to account for length of the `#` COMMENT token.
43
- }
40
+ notify :warning, {
41
+ message: "Duplicate #{type_str(idx)} parameter documentation for #{idx[:name_token].value}::#{parameter}",
42
+ line: token.line,
43
+ column: token.column + token.value.match(/\A\s*(@param\s*)?/)[0].length + 1, # `+ 1` is to account for length of the `#` COMMENT token.
44
+ }
44
45
  end
45
46
  end
46
47
 
@@ -50,30 +51,30 @@ PuppetLint.new_check(:parameter_documentation) do
50
51
  next if params.find { |p| p.value == parameter }
51
52
 
52
53
  notify :warning, {
53
- :message => "No matching #{type_str(idx)} parameter for documentation of #{idx[:name_token].value}::#{parameter}",
54
- :line => token.line,
55
- :column => token.column + token.value.match(/\A\s*(@param\s*)?/)[0].length + 1
54
+ message: "No matching #{type_str(idx)} parameter for documentation of #{idx[:name_token].value}::#{parameter}",
55
+ line: token.line,
56
+ column: token.column + token.value.match(/\A\s*(@param\s*)?/)[0].length + 1,
56
57
  }
57
58
  end
58
59
 
59
- unless is_private
60
- params.each do |p|
61
- if doc_params.has_key? p.value
62
- style = doc_params_styles[p.value] || 'unknown'
63
- unless allowed_styles.include?(style)
64
- notify :warning, {
65
- :message => "invalid documentation style for #{type_str(idx)} parameter #{idx[:name_token].value}::#{p.value} (#{doc_params_styles[p.value]})",
66
- :line => p.line,
67
- :column => p.column,
68
- }
69
- end
70
- else
60
+ next if is_private
61
+
62
+ params.each do |p|
63
+ if doc_params.has_key? p.value
64
+ style = doc_params_styles[p.value] || 'unknown'
65
+ unless allowed_styles.include?(style)
71
66
  notify :warning, {
72
- :message => "missing documentation for #{type_str(idx)} parameter #{idx[:name_token].value}::#{p.value}",
73
- :line => p.line,
74
- :column => p.column,
67
+ message: "invalid documentation style for #{type_str(idx)} parameter #{idx[:name_token].value}::#{p.value} (#{doc_params_styles[p.value]})",
68
+ line: p.line,
69
+ column: p.column,
75
70
  }
76
71
  end
72
+ else
73
+ notify :warning, {
74
+ message: "missing documentation for #{type_str(idx)} parameter #{idx[:name_token].value}::#{p.value}",
75
+ line: p.line,
76
+ column: p.column,
77
+ }
77
78
  end
78
79
  end
79
80
  end
@@ -82,7 +83,7 @@ PuppetLint.new_check(:parameter_documentation) do
82
83
  private
83
84
 
84
85
  def type_str(idx)
85
- idx[:type] == :CLASS ? "class" : "defined type"
86
+ idx[:type] == :CLASS ? 'class' : 'defined type'
86
87
  end
87
88
 
88
89
  def extract_params(idx)
@@ -92,20 +93,20 @@ PuppetLint.new_check(:parameter_documentation) do
92
93
  e = idx[:param_tokens].each
93
94
  begin
94
95
  while (ptok = e.next)
95
- if ptok.type == :VARIABLE
96
- params << ptok
97
- nesting = 0
98
- # skip to the next parameter to avoid finding default values of variables
99
- while true
100
- ptok = e.next
101
- case ptok.type
102
- when :LPAREN, :LBRACK, :LBRACE
103
- nesting += 1
104
- when :RPAREN, :RBRACK, :RBRACE
105
- nesting -= 1
106
- when :COMMA
107
- break unless nesting > 0
108
- end
96
+ next unless ptok.type == :VARIABLE
97
+
98
+ params << ptok
99
+ nesting = 0
100
+ # skip to the next parameter to avoid finding default values of variables
101
+ while true
102
+ ptok = e.next
103
+ case ptok.type
104
+ when :LPAREN, :LBRACK, :LBRACE
105
+ nesting += 1
106
+ when :RPAREN, :RBRACK, :RBRACE
107
+ nesting -= 1
108
+ when :COMMA
109
+ break unless nesting > 0
109
110
  end
110
111
  end
111
112
  end
@@ -119,13 +120,13 @@ PuppetLint.new_check(:parameter_documentation) do
119
120
  def detect_style(dtok)
120
121
  style = nil
121
122
  case dtok.value
122
- when %r{\A\s*\[\*([a-zA-Z0-9_]+)\*\]\s*(.*)\z}
123
+ when /\A\s*\[\*([a-zA-Z0-9_]+)\*\]\s*(.*)\z/
123
124
  style = 'doc'
124
- when %r{\A\s*\$([a-zA-Z0-9_]+):: +(.*)\z}
125
+ when /\A\s*\$([a-zA-Z0-9_]+):: +(.*)\z/
125
126
  style = 'kafo'
126
- when %r{\A\s*@param (?:\[.+\] )?([a-zA-Z0-9_]+)(?: +|$)(.*)\z}
127
+ when /\A\s*@param (?:\[.+\] )?([a-zA-Z0-9_]+)(?: +|$)(.*)\z/
127
128
  style = 'strings'
128
129
  end
129
- [ style, * $~ ]
130
+ [style, * $~]
130
131
  end
131
132
  end
@@ -12,7 +12,7 @@ module PuppetLintParamDocs
12
12
  class RakeTask < ::Rake::TaskLib
13
13
  include ::Rake::DSL if defined?(::Rake::DSL)
14
14
 
15
- def define_selective(&task_block)
15
+ def define_selective
16
16
  PuppetLint::RakeTask.new(:lint_param_docs) do |config|
17
17
  config.fail_on_warnings = true
18
18
  config.disable_checks = (PuppetLint.configuration.checks - [:parameter_documentation])
@@ -9,11 +9,11 @@ describe 'parameter_documentation' do
9
9
  context 'class missing any documentation' do
10
10
  let(:code) { 'class example($foo) { }' }
11
11
 
12
- it 'should detect a single problem' do
12
+ it 'detects a single problem' do
13
13
  expect(problems).to have(1).problem
14
14
  end
15
15
 
16
- it 'should create a warning' do
16
+ it 'creates a warning' do
17
17
  expect(problems).to contain_warning(class_msg % :foo).on_line(1).in_column(15)
18
18
  end
19
19
  end
@@ -21,23 +21,23 @@ describe 'parameter_documentation' do
21
21
  context 'define missing any documentation' do
22
22
  let(:code) { 'define example($foo) { }' }
23
23
 
24
- it 'should detect a single problem' do
24
+ it 'detects a single problem' do
25
25
  expect(problems).to have(1).problem
26
26
  end
27
27
 
28
- it 'should create a warning' do
29
- expect(problems).to contain_warning(define_msg% :foo).on_line(1).in_column(16)
28
+ it 'creates a warning' do
29
+ expect(problems).to contain_warning(define_msg % :foo).on_line(1).in_column(16)
30
30
  end
31
31
  end
32
32
 
33
33
  context 'class with param defaults' do
34
34
  let(:code) { 'class example($foo = $example::params::foo) { }' }
35
35
 
36
- it 'should detect a single problem' do
36
+ it 'detects a single problem' do
37
37
  expect(problems).to have(1).problem
38
38
  end
39
39
 
40
- it 'should create a warning' do
40
+ it 'creates a warning' do
41
41
  expect(problems).to contain_warning(class_msg % :foo).on_line(1).in_column(15)
42
42
  end
43
43
  end
@@ -45,11 +45,11 @@ describe 'parameter_documentation' do
45
45
  context 'define with param defaults' do
46
46
  let(:code) { 'define example($foo = $example::params::foo) { }' }
47
47
 
48
- it 'should detect a single problem' do
48
+ it 'detects a single problem' do
49
49
  expect(problems).to have(1).problem
50
50
  end
51
51
 
52
- it 'should create a warning' do
52
+ it 'creates a warning' do
53
53
  expect(problems).to contain_warning(define_msg % :foo).on_line(1).in_column(16)
54
54
  end
55
55
  end
@@ -57,45 +57,45 @@ describe 'parameter_documentation' do
57
57
  context 'define with param defaults using a function' do
58
58
  let(:code) { 'define example($foo = min(8, $facts["processors"]["count"])) { }' }
59
59
 
60
- it 'should detect a single problem' do
60
+ it 'detects a single problem' do
61
61
  expect(problems).to have(1).problem
62
62
  end
63
63
 
64
- it 'should create a warning' do
64
+ it 'creates a warning' do
65
65
  expect(problems).to contain_warning(define_msg % :foo).on_line(1).in_column(16)
66
66
  end
67
67
  end
68
68
 
69
69
  context 'class with many param defaults' do
70
70
  let(:code) do
71
- <<-EOS
72
- class foreman (
73
- $foreman_url = $foreman::params::foreman_url,
74
- $unattended = $foreman::params::unattended,
75
- $authentication = $foreman::params::authentication,
76
- $passenger = $foreman::params::passenger,
77
- ) {}
71
+ <<~EOS
72
+ class foreman (
73
+ $foreman_url = $foreman::params::foreman_url,
74
+ $unattended = $foreman::params::unattended,
75
+ $authentication = $foreman::params::authentication,
76
+ $passenger = $foreman::params::passenger,
77
+ ) {}
78
78
  EOS
79
79
  end
80
80
 
81
- it 'should detect four problems' do
81
+ it 'detects four problems' do
82
82
  expect(problems).to have(4).problems
83
83
  end
84
84
  end
85
85
 
86
86
  context 'define with many param defaults' do
87
87
  let(:code) do
88
- <<-EOS
89
- define foreman (
90
- $foreman_url = $foreman::params::foreman_url,
91
- $unattended = $foreman::params::unattended,
92
- $authentication = $foreman::params::authentication,
93
- $passenger = $foreman::params::passenger,
94
- ) {}
88
+ <<~EOS
89
+ define foreman (
90
+ $foreman_url = $foreman::params::foreman_url,
91
+ $unattended = $foreman::params::unattended,
92
+ $authentication = $foreman::params::authentication,
93
+ $passenger = $foreman::params::passenger,
94
+ ) {}
95
95
  EOS
96
96
  end
97
97
 
98
- it 'should detect four problems' do
98
+ it 'detects four problems' do
99
99
  expect(problems).to have(4).problems
100
100
  end
101
101
  end
@@ -113,11 +113,11 @@ define foreman (
113
113
  EOS
114
114
  end
115
115
 
116
- it 'should detect a single problem' do
116
+ it 'detects a single problem' do
117
117
  expect(problems).to have(1).problem
118
118
  end
119
119
 
120
- it 'should create a warning' do
120
+ it 'creates a warning' do
121
121
  expect(problems).to contain_warning(class_msg % :foo).on_line(7).in_column(15)
122
122
  end
123
123
  end
@@ -135,11 +135,11 @@ define foreman (
135
135
  EOS
136
136
  end
137
137
 
138
- it 'should detect a single problem' do
138
+ it 'detects a single problem' do
139
139
  expect(problems).to have(1).problem
140
140
  end
141
141
 
142
- it 'should create a warning' do
142
+ it 'creates a warning' do
143
143
  expect(problems).to contain_warning(define_msg % :foo).on_line(7).in_column(16)
144
144
  end
145
145
  end
@@ -154,11 +154,11 @@ define foreman (
154
154
  EOS
155
155
  end
156
156
 
157
- it 'should detect a single problem' do
157
+ it 'detects a single problem' do
158
158
  expect(problems).to have(1).problem
159
159
  end
160
160
 
161
- it 'should create a warning' do
161
+ it 'creates a warning' do
162
162
  expect(problems).to contain_warning(class_msg % :foo).on_line(4).in_column(15)
163
163
  end
164
164
  end
@@ -175,11 +175,11 @@ define foreman (
175
175
  EOS
176
176
  end
177
177
 
178
- it 'should detect no single problems' do
178
+ it 'detects no single problems' do
179
179
  expect(problems).to have(0).problems
180
180
  end
181
181
 
182
- it 'should not create a warning' do
182
+ it 'does not create a warning' do
183
183
  expect(problems).not_to contain_info(class_msg % :foo)
184
184
  end
185
185
  end
@@ -194,11 +194,11 @@ define foreman (
194
194
  EOS
195
195
  end
196
196
 
197
- it 'should detect a single problem' do
197
+ it 'detects a single problem' do
198
198
  expect(problems).to have(1).problem
199
199
  end
200
200
 
201
- it 'should create a warning' do
201
+ it 'creates a warning' do
202
202
  expect(problems).to contain_warning(define_msg % :foo).on_line(4).in_column(16)
203
203
  end
204
204
  end
@@ -216,11 +216,11 @@ define foreman (
216
216
  EOS
217
217
  end
218
218
 
219
- it 'should detect a single problem' do
219
+ it 'detects a single problem' do
220
220
  expect(problems).to have(1).problem
221
221
  end
222
222
 
223
- it 'should create a warning' do
223
+ it 'creates a warning' do
224
224
  expect(problems).to contain_warning(class_msg % :foo).on_line(7).in_column(15)
225
225
  end
226
226
  end
@@ -238,11 +238,11 @@ define foreman (
238
238
  EOS
239
239
  end
240
240
 
241
- it 'should detect a single problem' do
241
+ it 'detects a single problem' do
242
242
  expect(problems).to have(1).problem
243
243
  end
244
244
 
245
- it 'should create a warning' do
245
+ it 'creates a warning' do
246
246
  expect(problems).to contain_warning(define_msg % :foo).on_line(7).in_column(16)
247
247
  end
248
248
  end
@@ -260,11 +260,11 @@ define foreman (
260
260
  EOS
261
261
  end
262
262
 
263
- it 'should detect two problem' do
263
+ it 'detects two problem' do
264
264
  expect(problems).to have(2).problems
265
265
  end
266
266
 
267
- it 'should create two warnings' do
267
+ it 'creates two warnings' do
268
268
  expect(problems).to contain_warning(class_msg % :foo).on_line(7).in_column(15)
269
269
  expect(problems).to contain_warning(class_msg % :baz).on_line(7).in_column(27)
270
270
  end
@@ -283,11 +283,11 @@ define foreman (
283
283
  EOS
284
284
  end
285
285
 
286
- it 'should detect two problem' do
286
+ it 'detects two problem' do
287
287
  expect(problems).to have(2).problems
288
288
  end
289
289
 
290
- it 'should create two warnings' do
290
+ it 'creates two warnings' do
291
291
  expect(problems).to contain_warning(define_msg % :foo).on_line(7).in_column(16)
292
292
  expect(problems).to contain_warning(define_msg % :baz).on_line(7).in_column(28)
293
293
  end
@@ -306,11 +306,11 @@ define foreman (
306
306
  EOS
307
307
  end
308
308
 
309
- it 'should detect two problem' do
309
+ it 'detects two problem' do
310
310
  expect(problems).to have(2).problems
311
311
  end
312
312
 
313
- it 'should create two warnings' do
313
+ it 'creates two warnings' do
314
314
  expect(problems).to contain_warning(class_msg % :foo).on_line(7).in_column(15)
315
315
  expect(problems).to contain_warning(class_msg % :baz).on_line(7).in_column(27)
316
316
  end
@@ -329,11 +329,11 @@ define foreman (
329
329
  EOS
330
330
  end
331
331
 
332
- it 'should detect two problem' do
332
+ it 'detects two problem' do
333
333
  expect(problems).to have(2).problems
334
334
  end
335
335
 
336
- it 'should create two warnings' do
336
+ it 'creates two warnings' do
337
337
  expect(problems).to contain_warning(define_msg % :foo).on_line(7).in_column(16)
338
338
  expect(problems).to contain_warning(define_msg % :baz).on_line(7).in_column(28)
339
339
  end
@@ -352,7 +352,7 @@ define foreman (
352
352
  EOS
353
353
  end
354
354
 
355
- it 'should not detect any problems' do
355
+ it 'does not detect any problems' do
356
356
  expect(problems).to have(0).problems
357
357
  end
358
358
  end
@@ -378,18 +378,19 @@ define foreman (
378
378
  before do
379
379
  PuppetLint.configuration.docs_allowed_styles = ['noexist']
380
380
  end
381
+
381
382
  after do
382
383
  PuppetLint.configuration.docs_allowed_styles = false
383
384
  end
384
385
 
385
- it 'should detect three problems' do
386
+ it 'detects three problems' do
386
387
  expect(problems).to have(3).problems
387
388
  end
388
389
 
389
- it 'should create three problems' do
390
- expect(problems).to contain_warning(class_style_msg % [:foo, 'kafo']).on_line(11).in_column(21)
391
- expect(problems).to contain_warning(class_style_msg % [:bar, 'doc']).on_line(11).in_column(27)
392
- expect(problems).to contain_warning(class_style_msg % [:foobar, 'strings']).on_line(11).in_column(33)
390
+ it 'creates three problems' do
391
+ expect(problems).to contain_warning(format(class_style_msg, :foo, 'kafo')).on_line(11).in_column(21)
392
+ expect(problems).to contain_warning(format(class_style_msg, :bar, 'doc')).on_line(11).in_column(27)
393
+ expect(problems).to contain_warning(format(class_style_msg, :foobar, 'strings')).on_line(11).in_column(33)
393
394
  end
394
395
  end
395
396
 
@@ -397,22 +398,22 @@ define foreman (
397
398
  before do
398
399
  PuppetLint.configuration.docs_allowed_styles = 'strings'
399
400
  end
401
+
400
402
  after do
401
403
  PuppetLint.configuration.docs_allowed_styles = nil
402
404
  end
403
405
 
404
- it 'should detect two problems' do
406
+ it 'detects two problems' do
405
407
  expect(problems).to have(2).problems
406
408
  end
407
409
 
408
- it 'should create three problems' do
409
- expect(problems).to contain_warning(class_style_msg % [:foo, 'kafo']).on_line(11).in_column(21)
410
- expect(problems).to contain_warning(class_style_msg % [:bar, 'doc']).on_line(11).in_column(27)
410
+ it 'creates three problems' do
411
+ expect(problems).to contain_warning(format(class_style_msg, :foo, 'kafo')).on_line(11).in_column(21)
412
+ expect(problems).to contain_warning(format(class_style_msg, :bar, 'doc')).on_line(11).in_column(27)
411
413
  end
412
414
  end
413
415
  end
414
416
 
415
-
416
417
  context 'define with all parameters documented ($foo::)' do
417
418
  let(:code) do
418
419
  <<-EOS
@@ -426,7 +427,7 @@ define foreman (
426
427
  EOS
427
428
  end
428
429
 
429
- it 'should not detect any problems' do
430
+ it 'does not detect any problems' do
430
431
  expect(problems).to have(0).problems
431
432
  end
432
433
  end
@@ -444,7 +445,7 @@ define foreman (
444
445
  EOS
445
446
  end
446
447
 
447
- it 'should not detect any problems' do
448
+ it 'does not detect any problems' do
448
449
  expect(problems).to have(0).problems
449
450
  end
450
451
  end
@@ -462,7 +463,7 @@ define foreman (
462
463
  EOS
463
464
  end
464
465
 
465
- it 'should not detect any problems' do
466
+ it 'does not detect any problems' do
466
467
  expect(problems).to have(0).problems
467
468
  end
468
469
  end
@@ -485,7 +486,7 @@ define foreman (
485
486
  EOS
486
487
  end
487
488
 
488
- it 'should not detect any problems' do
489
+ it 'does not detect any problems' do
489
490
  expect(problems).to have(0).problems
490
491
  end
491
492
  end
@@ -508,7 +509,7 @@ define foreman (
508
509
  EOS
509
510
  end
510
511
 
511
- it 'should not detect any problems' do
512
+ it 'does not detect any problems' do
512
513
  expect(problems).to have(0).problems
513
514
  end
514
515
  end
@@ -524,7 +525,7 @@ define foreman (
524
525
  EOS
525
526
  end
526
527
 
527
- it 'should not detect any problems' do
528
+ it 'does not detect any problems' do
528
529
  expect(problems).to have(0).problems
529
530
  end
530
531
  end
@@ -544,7 +545,7 @@ define foreman (
544
545
  EOS
545
546
  end
546
547
 
547
- it 'should not detect any problems' do
548
+ it 'does not detect any problems' do
548
549
  expect(problems).to have(0).problems
549
550
  end
550
551
  end
@@ -552,7 +553,7 @@ define foreman (
552
553
  context 'class without parameters' do
553
554
  let(:code) { 'class example { }' }
554
555
 
555
- it 'should not detect any problems' do
556
+ it 'does not detect any problems' do
556
557
  expect(problems).to have(0).problems
557
558
  end
558
559
  end
@@ -560,7 +561,7 @@ define foreman (
560
561
  context 'define without parameters' do
561
562
  let(:code) { 'define example { }' }
562
563
 
563
- it 'should not detect any problems' do
564
+ it 'does not detect any problems' do
564
565
  expect(problems).to have(0).problems
565
566
  end
566
567
  end
@@ -568,7 +569,7 @@ define foreman (
568
569
  context 'class without parameters and a function call' do
569
570
  let(:code) { 'class example { a($foo::bar) }' }
570
571
 
571
- it 'should not detect any problems' do
572
+ it 'does not detect any problems' do
572
573
  expect(problems).to have(0).problems
573
574
  end
574
575
  end
@@ -576,7 +577,7 @@ define foreman (
576
577
  context 'define without parameters and a function call' do
577
578
  let(:code) { 'define example { a($foo::bar) }' }
578
579
 
579
- it 'should not detect any problems' do
580
+ it 'does not detect any problems' do
580
581
  expect(problems).to have(0).problems
581
582
  end
582
583
  end
@@ -594,11 +595,11 @@ define foreman (
594
595
  EOS
595
596
  end
596
597
 
597
- it 'should detect a single problem' do
598
+ it 'detects a single problem' do
598
599
  expect(problems).to have(1).problem
599
600
  end
600
601
 
601
- it 'should create a warning' do
602
+ it 'creates a warning' do
602
603
  expect(problems).to contain_warning(class_msg % :foo).on_line(7).in_column(15)
603
604
  end
604
605
  end
@@ -621,15 +622,15 @@ define foreman (
621
622
  EOS
622
623
  end
623
624
 
624
- it 'should detect two problems' do
625
+ it 'detects two problems' do
625
626
  expect(problems).to have(2).problem
626
627
  end
627
628
 
628
- it 'should create a warning on line 3' do
629
+ it 'creates a warning on line 3' do
629
630
  expect(problems).to contain_warning(class_msg % :bar).on_line(3).in_column(10)
630
631
  end
631
632
 
632
- it 'should create a warning on line 6' do
633
+ it 'creates a warning on line 6' do
633
634
  expect(problems).to contain_warning(class_msg % :bar).on_line(6).in_column(10)
634
635
  end
635
636
  end
@@ -648,15 +649,15 @@ define foreman (
648
649
  EOS
649
650
  end
650
651
 
651
- it 'should detect two problems' do
652
+ it 'detects two problems' do
652
653
  expect(problems).to have(2).problem
653
654
  end
654
655
 
655
- it 'should create a warning on line 3' do
656
+ it 'creates a warning on line 3' do
656
657
  expect(problems).to contain_warning(define_msg % :bar).on_line(3).in_column(10)
657
658
  end
658
659
 
659
- it 'should create a warning on line 6' do
660
+ it 'creates a warning on line 6' do
660
661
  expect(problems).to contain_warning(define_msg % :bar).on_line(6).in_column(10)
661
662
  end
662
663
  end
@@ -678,19 +679,19 @@ define foreman (
678
679
  EOS
679
680
  end
680
681
 
681
- it 'should detect three problems' do
682
+ it 'detects three problems' do
682
683
  expect(problems).to have(3).problem
683
684
  end
684
685
 
685
- it 'should create a warning on line 3' do
686
+ it 'creates a warning on line 3' do
686
687
  expect(problems).to contain_warning(class_msg % :bar).on_line(3).in_column(10)
687
688
  end
688
689
 
689
- it 'should create a warning on line 6' do
690
+ it 'creates a warning on line 6' do
690
691
  expect(problems).to contain_warning(class_msg % :bar).on_line(6).in_column(10)
691
692
  end
692
693
 
693
- it 'should create a warning on line 8' do
694
+ it 'creates a warning on line 8' do
694
695
  expect(problems).to contain_warning(class_msg % :bar).on_line(8).in_column(10)
695
696
  end
696
697
  end
@@ -708,15 +709,15 @@ define foreman (
708
709
  EOS
709
710
  end
710
711
 
711
- it 'should detect two problems' do
712
+ it 'detects two problems' do
712
713
  expect(problems).to have(2).problem
713
714
  end
714
715
 
715
- it 'should create a warning on line 3' do
716
+ it 'creates a warning on line 3' do
716
717
  expect(problems).to contain_warning(class_msg % :bar).on_line(3).in_column(10)
717
718
  end
718
719
 
719
- it 'should create a warning on line 4' do
720
+ it 'creates a warning on line 4' do
720
721
  expect(problems).to contain_warning(class_msg % :bar).on_line(4).in_column(10)
721
722
  end
722
723
  end
@@ -735,15 +736,15 @@ define foreman (
735
736
  EOS
736
737
  end
737
738
 
738
- it 'should detect two problems' do
739
+ it 'detects two problems' do
739
740
  expect(problems).to have(2).problem
740
741
  end
741
742
 
742
- it 'should create a warning on line 3' do
743
+ it 'creates a warning on line 3' do
743
744
  expect(problems).to contain_warning(class_msg % :bar).on_line(3).in_column(10)
744
745
  end
745
746
 
746
- it 'should create a warning on line 6' do
747
+ it 'creates a warning on line 6' do
747
748
  expect(problems).to contain_warning(class_msg % :bar).on_line(6).in_column(3)
748
749
  end
749
750
  end
@@ -759,11 +760,11 @@ define foreman (
759
760
  EOS
760
761
  end
761
762
 
762
- it 'should detect a single problem' do
763
+ it 'detects a single problem' do
763
764
  expect(problems).to have(1).problem
764
765
  end
765
766
 
766
- it 'should create a warning on line 3' do
767
+ it 'creates a warning on line 3' do
767
768
  expect(problems).to contain_warning('No matching class parameter for documentation of example::foo').on_line(3).in_column(10)
768
769
  end
769
770
  end
@@ -781,11 +782,11 @@ define foreman (
781
782
  EOS
782
783
  end
783
784
 
784
- it 'should detect a single problem' do
785
+ it 'detects a single problem' do
785
786
  expect(problems).to have(1).problem
786
787
  end
787
788
 
788
- it 'should create a warning on line 3' do
789
+ it 'creates a warning on line 3' do
789
790
  expect(problems).to contain_warning('No matching class parameter for documentation of example::foo').on_line(3).in_column(10)
790
791
  end
791
792
  end
@@ -804,11 +805,11 @@ define foreman (
804
805
  EOS
805
806
  end
806
807
 
807
- it 'should detect a single problem' do
808
+ it 'detects a single problem' do
808
809
  expect(problems).to have(1).problem
809
810
  end
810
811
 
811
- it 'should create a warning on line 4' do
812
+ it 'creates a warning on line 4' do
812
813
  expect(problems).to contain_warning('No matching defined type parameter for documentation of example::example::foo').on_line(4).in_column(10)
813
814
  end
814
815
  end
@@ -822,10 +823,10 @@ define foreman (
822
823
  # Docs for the $name
823
824
  # @param bar Docs for bar
824
825
  define example::example(String[1] $bar) { }
825
- EOS
826
+ EOS
826
827
  end
827
828
 
828
- it 'should not detect any problems' do
829
+ it 'does not detect any problems' do
829
830
  expect(problems).to have(0).problems
830
831
  end
831
832
  end
@@ -838,14 +839,14 @@ define foreman (
838
839
  # @param name
839
840
  # Invalid docs
840
841
  class example { }
841
- EOS
842
+ EOS
842
843
  end
843
844
 
844
- it 'should detect a single problem' do
845
+ it 'detects a single problem' do
845
846
  expect(problems).to have(1).problem
846
847
  end
847
848
 
848
- it 'should create a warning on line 3' do
849
+ it 'creates a warning on line 3' do
849
850
  expect(problems).to contain_warning('No matching class parameter for documentation of example::name').on_line(3).in_column(10)
850
851
  end
851
852
  end
@@ -859,10 +860,10 @@ define foreman (
859
860
  # Docs for the $title
860
861
  # @param bar Docs for bar
861
862
  define example::example(String[1] $bar) { }
862
- EOS
863
+ EOS
863
864
  end
864
865
 
865
- it 'should not detect any problems' do
866
+ it 'does not detect any problems' do
866
867
  expect(problems).to have(0).problems
867
868
  end
868
869
  end
@@ -875,14 +876,14 @@ define foreman (
875
876
  # @param title
876
877
  # Invalid docs
877
878
  class example { }
878
- EOS
879
+ EOS
879
880
  end
880
881
 
881
- it 'should detect a single problem' do
882
+ it 'detects a single problem' do
882
883
  expect(problems).to have(1).problem
883
884
  end
884
885
 
885
- it 'should create a warning on line 3' do
886
+ it 'creates a warning on line 3' do
886
887
  expect(problems).to contain_warning('No matching class parameter for documentation of example::title').on_line(3).in_column(10)
887
888
  end
888
889
  end
@@ -898,18 +899,18 @@ define foreman (
898
899
  # Docs for the $name
899
900
  # @param bar Docs for bar
900
901
  define example(String[1] $bar) { }
901
- EOS
902
+ EOS
902
903
  end
903
904
 
904
- it 'should detect two problems' do
905
+ it 'detects two problems' do
905
906
  expect(problems).to have(2).problems
906
907
  end
907
908
 
908
- it 'should create a warning on line 3' do
909
+ it 'creates a warning on line 3' do
909
910
  expect(problems).to contain_warning('Duplicate defined type parameter documentation for example::name/title').on_line(3).in_column(10)
910
911
  end
911
912
 
912
- it 'should create a warning on line 5' do
913
+ it 'creates a warning on line 5' do
913
914
  expect(problems).to contain_warning('Duplicate defined type parameter documentation for example::name/title').on_line(5).in_column(10)
914
915
  end
915
916
  end
@@ -951,7 +952,7 @@ define foreman (
951
952
  EOS
952
953
  end
953
954
 
954
- it 'should not detect any problems' do
955
+ it 'does not detect any problems' do
955
956
  expect(problems).to have(0).problems
956
957
  end
957
958
  end
@@ -1001,7 +1002,7 @@ define foreman (
1001
1002
  EOS
1002
1003
  end
1003
1004
 
1004
- it 'should not detect any problems' do
1005
+ it 'does not detect any problems' do
1005
1006
  puts problems
1006
1007
  expect(problems).to have(0).problems
1007
1008
  end
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.7.6
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-29 00:00:00.000000000 Z
11
+ date: 2023-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet-lint
@@ -16,104 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.1'
19
+ version: '3'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '4.0'
22
+ version: '5'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '1.1'
29
+ version: '3'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '4.0'
33
- - !ruby/object:Gem::Dependency
34
- name: rspec
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '3.0'
40
- type: :development
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: '3.0'
47
- - !ruby/object:Gem::Dependency
48
- name: rspec-its
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '1.0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '1.0'
61
- - !ruby/object:Gem::Dependency
62
- name: rspec-collection_matchers
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '1.0'
68
- type: :development
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '1.0'
75
- - !ruby/object:Gem::Dependency
76
- name: rake
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- version: '0'
82
- type: :development
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- version: '0'
89
- - !ruby/object:Gem::Dependency
90
- name: simplecov-console
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- version: '0'
96
- type: :development
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: '0'
103
- - !ruby/object:Gem::Dependency
104
- name: codecov
105
- requirement: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
- type: :development
111
- prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- version: '0'
32
+ version: '5'
117
33
  description: " A new check for puppet-lint that validates all parameters are documented.\n"
118
34
  email: voxpupuli@groups.io
119
35
  executables: []
@@ -122,9 +38,9 @@ extra_rdoc_files: []
122
38
  files:
123
39
  - LICENSE
124
40
  - README.md
125
- - lib/puppet-lint-param-docs.rb
126
41
  - lib/puppet-lint-param-docs/tasks.rb
127
42
  - lib/puppet-lint/plugins/check_parameter_documentation.rb
43
+ - lib/puppet_lint_param_docs.rb
128
44
  - spec/puppet-lint/plugins/check_parameter_documentation_spec.rb
129
45
  - spec/spec_helper.rb
130
46
  homepage: https://github.com/voxpupuli/puppet-lint-param-docs
@@ -139,7 +55,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
139
55
  requirements:
140
56
  - - ">="
141
57
  - !ruby/object:Gem::Version
142
- version: '0'
58
+ version: 2.7.0
143
59
  required_rubygems_version: !ruby/object:Gem::Requirement
144
60
  requirements:
145
61
  - - ">="
@@ -150,6 +66,4 @@ rubygems_version: 3.2.33
150
66
  signing_key:
151
67
  specification_version: 4
152
68
  summary: puppet-lint check to validate all parameters are documented
153
- test_files:
154
- - spec/puppet-lint/plugins/check_parameter_documentation_spec.rb
155
- - spec/spec_helper.rb
69
+ test_files: []