puppet-lint-param-docs 1.5.0 → 1.5.1

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: 8f8b9401c298a02b66324e5ef2db75b5e1e498d19a0a64e0e4d05208003da40b
4
- data.tar.gz: 0ddfcd5cf79cbd88e60b59c5645e636e60092efcf305fe5c71ecc73d3580ca84
3
+ metadata.gz: 14633dfc2336826ed35662bf1840e6ef992f0032146f2a932a988a42521b2006
4
+ data.tar.gz: 9f7a4139402ebe4d390f07b38ed5013e4f10b42bf3e793d8b6a4e05c170d25c6
5
5
  SHA512:
6
- metadata.gz: 50e90eccc7fd99371a2d59d125b0e6483f2b0a2b002f018339d81320aee9b44b89627b5c1178e710341c8cb2ca31d4893bda414e53a0b5b2530d83476726676f
7
- data.tar.gz: c1038644ed09895de383ed28d87e5041afd3fd7efc665f3dabf58c53aa89f9b2fc51f54e9ae5d35b725b71ac75d8fea1c1bc84c47b6610cfe7bb48c0639ed198
6
+ metadata.gz: 9c685fe25b7b03c9af645f2ff82ea4c86e3c820ce3343c16b4a8926be097a0e3fa4723910a7f5c71e555978101dc61a0739f6496abcae8eea2ca4296a8a3ec14
7
+ data.tar.gz: d696ad85c260c8956787f27a3af8b37a8b26526b57d789f005881ae89de538241fbaa7daca6ad03abd6e0576db71a306c1227f8b3cecb226dc4cd44d18a7927e
@@ -28,10 +28,18 @@ PuppetLint.new_check(:parameter_documentation) do
28
28
  while (ptok = e.next)
29
29
  if ptok.type == :VARIABLE
30
30
  params << ptok
31
+ nesting = 0
31
32
  # skip to the next parameter to avoid finding default values of variables
32
33
  while true
33
34
  ptok = e.next
34
- break if ptok.type == :COMMA
35
+ case ptok.type
36
+ when :LPAREN
37
+ nesting += 1
38
+ when :RPAREN
39
+ nesting -= 1
40
+ when :COMMA
41
+ break unless nesting > 0
42
+ end
35
43
  end
36
44
  end
37
45
  end
@@ -52,6 +52,18 @@ describe 'parameter_documentation' do
52
52
  end
53
53
  end
54
54
 
55
+ context 'define with param defaults using a function' do
56
+ let(:code) { 'define example($foo = min(8, $facts["processors"]["count"])) { }' }
57
+
58
+ it 'should detect a single problem' do
59
+ expect(problems).to have(1).problem
60
+ end
61
+
62
+ it 'should create a warning' do
63
+ expect(problems).to contain_warning(define_msg % :foo).on_line(1).in_column(16)
64
+ end
65
+ end
66
+
55
67
  context 'class with many param defaults' do
56
68
  let(:code) do
57
69
  <<-EOS
@@ -443,6 +455,42 @@ define foreman (
443
455
  end
444
456
  end
445
457
 
458
+ context 'define with all parameters documented with defaults (@param)' do
459
+ let(:code) do
460
+ <<-EOS
461
+ # Example define
462
+ #
463
+ # @param foo example
464
+ #
465
+ define example($foo = $facts['networking']['fqdn']) { }
466
+ EOS
467
+ end
468
+
469
+ it 'should not detect any problems' do
470
+ expect(problems).to have(0).problems
471
+ end
472
+ end
473
+
474
+ context 'define with all parameters documented with defaults using functions (@param)' do
475
+ let(:code) do
476
+ <<-EOS
477
+ # Example define
478
+ #
479
+ # @param foo example
480
+ # @param multiple test nested function calls
481
+ #
482
+ define example(
483
+ $foo = min(8, $facts['processors']['count']),
484
+ $multiple = min(8, max(2, $facts['processors']['count'])),
485
+ ) { }
486
+ EOS
487
+ end
488
+
489
+ it 'should not detect any problems' do
490
+ expect(problems).to have(0).problems
491
+ end
492
+ end
493
+
446
494
  context 'class without parameters' do
447
495
  let(:code) { 'class example { }' }
448
496
 
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.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-11 00:00:00.000000000 Z
11
+ date: 2020-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet-lint
@@ -132,7 +132,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  requirements: []
135
- rubygems_version: 3.0.2
135
+ rubyforge_project:
136
+ rubygems_version: 2.7.7
136
137
  signing_key:
137
138
  specification_version: 4
138
139
  summary: puppet-lint check to validate all parameters are documented