puppet-lint-param-docs 1.5.1 → 1.7.4

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: 14633dfc2336826ed35662bf1840e6ef992f0032146f2a932a988a42521b2006
4
- data.tar.gz: 9f7a4139402ebe4d390f07b38ed5013e4f10b42bf3e793d8b6a4e05c170d25c6
3
+ metadata.gz: a9437e6614a01b679417bbf8df3866b6d7e20ed66fb98192c009af45c167610d
4
+ data.tar.gz: f719e9dd7a34e642b24a36ac71b34d8391cec7dd374df5c86fda33604a1340b2
5
5
  SHA512:
6
- metadata.gz: 9c685fe25b7b03c9af645f2ff82ea4c86e3c820ce3343c16b4a8926be097a0e3fa4723910a7f5c71e555978101dc61a0739f6496abcae8eea2ca4296a8a3ec14
7
- data.tar.gz: d696ad85c260c8956787f27a3af8b37a8b26526b57d789f005881ae89de538241fbaa7daca6ad03abd6e0576db71a306c1227f8b3cecb226dc4cd44d18a7927e
6
+ metadata.gz: b89435c384da43d72d3c4bc1b2f7917c63d50f865f1dd002dda3a07093a89947bf84d0a2f2c0294ba9dd1dd1b896b6366d8c847c1bab8b598c02e72acb9e94ed
7
+ data.tar.gz: 545d57ef867a96e6fd4b7360dd688461c53537fdab4efcb8e0907771a73d13c5f4b6fc9aa18eda2b8ae02995346784af4d3f8d5658c9018c57bb63023f6b9e64
data/README.md CHANGED
@@ -19,56 +19,91 @@ gem 'puppet-lint-param-docs'
19
19
 
20
20
  This plugin provides a new check to `puppet-lint`.
21
21
 
22
- ### parameter_documentation
22
+ ### parameter\_documentation
23
23
 
24
24
  **--fix support: No**
25
25
 
26
26
  This check will raise a warning for any class or defined type parameters that
27
- don't have an RDoc description.
27
+ don't have a description.
28
28
 
29
29
  ```
30
30
  WARNING: missing documentation for class parameter foo::bar
31
31
  WARNING: missing documentation for defined type parameter foo::baz
32
32
  ```
33
33
 
34
+ It will also raise warnings for parameters documented more than once.
35
+
36
+ ```
37
+ WARNING Duplicate class parameter documentation for foo::bar on line 5
38
+ WARNING Duplicate class parameter documentation for foo::bar on line 6
39
+ ```
40
+
41
+ A warning will also be raised if you document a parameter that doesn't exist in the class or defined type.
42
+
43
+ ```
44
+ WARNING No matching class parameter for documentation of foo::bar
45
+ ```
46
+
34
47
  ### Documentation styles
35
48
 
49
+ By default, the check will allow all known documentation styles.
50
+ You can, however, specify a list of accepted formats:
51
+
52
+ ```ruby
53
+ # Limit to a single style
54
+ PuppetLint.configuration.docs_allowed_styles = 'strings'
55
+ # Limit to multiple styles
56
+ PuppetLint.configuration.docs_allowed_styles = ['strings', 'doc']
57
+ ```
58
+
59
+ It will raise a warning if the documentation style does not match.
60
+
61
+ ```
62
+ WARNING: invalid documentation style for class parameter foo::bar (doc) on line 4
63
+ ```
64
+
36
65
  The check will accept any of the following styles:
37
66
 
38
- #### Puppet Strings
67
+ #### Puppet Strings: `strings`
39
68
 
40
69
  Used by [Puppet Strings](https://github.com/puppetlabs/puppetlabs-strings).
41
70
 
42
- # Example class
43
- #
44
- # @param foo example
45
- define example($foo) { }
71
+ ```puppet
72
+ # @summary Example class
73
+ #
74
+ # @param foo example
75
+ define example($foo) { }
76
+ ```
46
77
 
47
- #### Puppet Doc style
78
+ #### Puppet Doc style: `doc`
48
79
 
49
- Used by the [puppet-doc](https://docs.puppetlabs.com/puppet/latest/reference/man/doc.html)
50
- command, generally deprecated in favour of Puppet Strings.
80
+ Used by the [puppet-doc](https://puppet.com/docs/puppet/6.18/man/doc.html)
81
+ command, deprecated in favour of Puppet Strings.
51
82
 
52
- # Example class
53
- #
54
- # === Parameters:
55
- #
56
- # [*foo*] example
57
- #
58
- class example($foo) { }
83
+ ```puppet
84
+ # Example class
85
+ #
86
+ # === Parameters:
87
+ #
88
+ # [*foo*] example
89
+ #
90
+ class example($foo) { }
91
+ ```
59
92
 
60
- #### Kafo rdoc style
93
+ #### Kafo rdoc style: `kafo`
61
94
 
62
95
  Used in [kafo](https://github.com/theforeman/kafo#documentation) following an
63
96
  rdoc style.
64
97
 
65
- # Example class
66
- #
67
- # === Parameters:
68
- #
69
- # $foo:: example
70
- #
71
- class example($foo) { }
98
+ ```puppet
99
+ # Example class
100
+ #
101
+ # === Parameters:
102
+ #
103
+ # $foo:: example
104
+ #
105
+ class example($foo) { }
106
+ ```
72
107
 
73
108
  ### Selective rake task
74
109
 
@@ -83,7 +118,7 @@ helper to customise the lint rake task:
83
118
  config.pattern = ['manifests/init.pp', 'manifests/other/**/*.pp']
84
119
  end
85
120
 
86
- This would disable the parameter_documentation check by default, but then
121
+ This would disable the parameter\_documentation check by default, but then
87
122
  defines a new rake task (which runs after `lint`) specifically for the files
88
123
  given in `config.pattern`.
89
124
 
@@ -1,59 +1,131 @@
1
1
  PuppetLint.new_check(:parameter_documentation) do
2
2
  def check
3
- class_indexes.concat(defined_type_indexes).each do |idx|
4
- next if idx[:param_tokens].nil?
3
+ allowed_styles = PuppetLint.configuration.docs_allowed_styles || ['doc', 'kafo', 'strings']
4
+ allowed_styles = [ allowed_styles ].flatten
5
5
 
6
- doc_params = []
6
+ class_indexes.concat(defined_type_indexes).each do |idx|
7
+ doc_params = {}
8
+ doc_params_styles = {}
9
+ doc_params_duplicates = Hash.new { |hash, key| hash[key] = [doc_params[key]] }
7
10
  is_private = false
8
11
  tokens[0..idx[:start]].reverse_each do |dtok|
9
12
  next if [:CLASS, :DEFINE, :NEWLINE, :WHITESPACE, :INDENT].include?(dtok.type)
10
- if [:COMMENT, :MLCOMMENT, :SLASH_COMMENT].include?(dtok.type)
11
- if dtok.value =~ /\A\s*\[\*([a-zA-Z0-9_]+)\*\]/ or
12
- dtok.value =~ /\A\s*\$([a-zA-Z0-9_]+):: +/ or
13
- dtok.value =~ /\A\s*@param (?:\[.+\] )?([a-zA-Z0-9_]+)(?: +|$)/
14
- doc_params << $1
13
+ if dtok.type == :COMMENT
14
+ if dtok.value =~ /\A\s*@api +private\s*$/
15
+ is_private = true
16
+ next
15
17
  end
16
18
 
17
- is_private = true if dtok.value =~ /\A\s*@api +private\s*$/
18
- else
19
- break
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
20
31
  end
21
32
  end
22
33
 
23
- next if is_private
24
-
25
- params = []
26
- e = idx[:param_tokens].each
27
- begin
28
- while (ptok = e.next)
29
- if ptok.type == :VARIABLE
30
- params << ptok
31
- nesting = 0
32
- # skip to the next parameter to avoid finding default values of variables
33
- while true
34
- ptok = e.next
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
43
- end
44
- end
34
+ params = extract_params(idx)
35
+
36
+ # warn about duplicates
37
+ doc_params_duplicates.each do |parameter, tokens|
38
+ 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
+ }
45
44
  end
46
- rescue StopIteration; end
45
+ end
46
+
47
+ # warn about documentation for parameters that don't exist
48
+ doc_params.each do |parameter, token|
49
+ next if parameter == 'name/title' && idx[:type] == :DEFINE
50
+ next if params.find { |p| p.value == parameter }
47
51
 
48
- params.each do |p|
49
- next if doc_params.include? p.value
50
- idx_type = idx[:type] == :CLASS ? "class" : "defined type"
51
52
  notify :warning, {
52
- :message => "missing documentation for #{idx_type} parameter #{idx[:name_token].value}::#{p.value}",
53
- :line => p.line,
54
- :column => p.column,
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
55
56
  }
56
57
  end
58
+
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
71
+ 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,
75
+ }
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+
82
+ private
83
+
84
+ def type_str(idx)
85
+ idx[:type] == :CLASS ? "class" : "defined type"
86
+ end
87
+
88
+ def extract_params(idx)
89
+ params = []
90
+ return params if idx[:param_tokens].nil?
91
+
92
+ e = idx[:param_tokens].each
93
+ begin
94
+ 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
103
+ nesting += 1
104
+ when :RPAREN
105
+ nesting -= 1
106
+ when :COMMA
107
+ break unless nesting > 0
108
+ end
109
+ end
110
+ end
111
+ end
112
+ rescue StopIteration; end
113
+
114
+ params
115
+ end
116
+
117
+ # returns an array [<detected_style>, <complete match>, <param name>, <same-line-docs>]
118
+ # [nil, nil] if this is not a parameter.
119
+ def detect_style(dtok)
120
+ style = nil
121
+ case dtok.value
122
+ when %r{\A\s*\[\*([a-zA-Z0-9_]+)\*\]\s*(.*)\z}
123
+ style = 'doc'
124
+ when %r{\A\s*\$([a-zA-Z0-9_]+):: +(.*)\z}
125
+ style = 'kafo'
126
+ when %r{\A\s*@param (?:\[.+\] )?([a-zA-Z0-9_]+)(?: +|$)(.*)\z}
127
+ style = 'strings'
57
128
  end
129
+ [ style, * $~ ]
58
130
  end
59
131
  end
@@ -3,6 +3,8 @@ require 'spec_helper'
3
3
  describe 'parameter_documentation' do
4
4
  let(:class_msg) { 'missing documentation for class parameter example::%s' }
5
5
  let(:define_msg) { 'missing documentation for defined type parameter example::%s' }
6
+ let(:class_style_msg) { 'invalid documentation style for class parameter example::%s (%s)' }
7
+ let(:define_style_msg) { 'invalid documentation style for defined type parameter example::%s (%s)' }
6
8
 
7
9
  context 'class missing any documentation' do
8
10
  let(:code) { 'class example($foo) { }' }
@@ -355,6 +357,62 @@ define foreman (
355
357
  end
356
358
  end
357
359
 
360
+ context 'check style' do
361
+ let(:code) do
362
+ <<-EOS
363
+ # Example mixed style class
364
+ #
365
+ # Parameters:
366
+ #
367
+ # $foo:: example
368
+ #
369
+ # [*bar*] example
370
+ #
371
+ # @param foobar example
372
+ #
373
+ class example($foo, $bar, $foobar) { }
374
+ EOS
375
+ end
376
+
377
+ context 'detect all styles' do
378
+ before do
379
+ PuppetLint.configuration.docs_allowed_styles = ['noexist']
380
+ end
381
+ after do
382
+ PuppetLint.configuration.docs_allowed_styles = false
383
+ end
384
+
385
+ it 'should detect three problems' do
386
+ expect(problems).to have(3).problems
387
+ end
388
+
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)
393
+ end
394
+ end
395
+
396
+ context 'use configured style' do
397
+ before do
398
+ PuppetLint.configuration.docs_allowed_styles = 'strings'
399
+ end
400
+ after do
401
+ PuppetLint.configuration.docs_allowed_styles = nil
402
+ end
403
+
404
+ it 'should detect two problems' do
405
+ expect(problems).to have(2).problems
406
+ end
407
+
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)
411
+ end
412
+ end
413
+ end
414
+
415
+
358
416
  context 'define with all parameters documented ($foo::)' do
359
417
  let(:code) do
360
418
  <<-EOS
@@ -544,4 +602,315 @@ define foreman (
544
602
  expect(problems).to contain_warning(class_msg % :foo).on_line(7).in_column(15)
545
603
  end
546
604
  end
605
+
606
+ describe 'Duplicated documentation' do
607
+ let(:class_msg) { 'Duplicate class parameter documentation for example::%s' }
608
+ let(:define_msg) { 'Duplicate defined type parameter documentation for example::%s' }
609
+
610
+ context 'class with parameters documented twice (@param)' do
611
+ let(:code) do
612
+ <<-EOS.gsub(/^\s+/, '')
613
+ # @summary Example class
614
+ #
615
+ # @param bar
616
+ # example
617
+ # @param foo example
618
+ # @param bar Duplicate/conflicting docs
619
+ #
620
+ class example($foo, $bar) { }
621
+ EOS
622
+ end
623
+
624
+ it 'should detect two problems' do
625
+ expect(problems).to have(2).problem
626
+ end
627
+
628
+ it 'should create a warning on line 3' do
629
+ expect(problems).to contain_warning(class_msg % :bar).on_line(3).in_column(10)
630
+ end
631
+
632
+ it 'should create a warning on line 6' do
633
+ expect(problems).to contain_warning(class_msg % :bar).on_line(6).in_column(10)
634
+ end
635
+ end
636
+
637
+ context 'define with parameters documented twice (@param)' do
638
+ let(:code) do
639
+ <<-EOS.gsub(/^\s+/, '')
640
+ # @summary Example define
641
+ #
642
+ # @param bar
643
+ # example
644
+ # @param foo example
645
+ # @param bar Duplicate/conflicting docs
646
+ #
647
+ define example($foo, $bar) { }
648
+ EOS
649
+ end
650
+
651
+ it 'should detect two problems' do
652
+ expect(problems).to have(2).problem
653
+ end
654
+
655
+ it 'should create a warning on line 3' do
656
+ expect(problems).to contain_warning(define_msg % :bar).on_line(3).in_column(10)
657
+ end
658
+
659
+ it 'should create a warning on line 6' do
660
+ expect(problems).to contain_warning(define_msg % :bar).on_line(6).in_column(10)
661
+ end
662
+ end
663
+
664
+ context 'class with parameters documented 3 times (@param)' do
665
+ let(:code) do
666
+ <<-EOS.gsub(/^\s+/, '')
667
+ # @summary Example class
668
+ #
669
+ # @param bar
670
+ # example
671
+ # @param foo example
672
+ # @param bar Duplicate/conflicting docs
673
+ #
674
+ # @param bar
675
+ # example
676
+ #
677
+ class example($foo, $bar) { }
678
+ EOS
679
+ end
680
+
681
+ it 'should detect three problems' do
682
+ expect(problems).to have(3).problem
683
+ end
684
+
685
+ it 'should create a warning on line 3' do
686
+ expect(problems).to contain_warning(class_msg % :bar).on_line(3).in_column(10)
687
+ end
688
+
689
+ it 'should create a warning on line 6' do
690
+ expect(problems).to contain_warning(class_msg % :bar).on_line(6).in_column(10)
691
+ end
692
+
693
+ it 'should create a warning on line 8' do
694
+ expect(problems).to contain_warning(class_msg % :bar).on_line(8).in_column(10)
695
+ end
696
+ end
697
+
698
+ context 'private class with parameters documented twice (@param)' do
699
+ let(:code) do
700
+ <<-EOS.gsub(/^\s+/, '')
701
+ # @summary Example class
702
+ #
703
+ # @param bar docs
704
+ # @param bar Duplicate/conflicting docs
705
+ #
706
+ # @api private
707
+ class example($bar) { }
708
+ EOS
709
+ end
710
+
711
+ it 'should detect two problems' do
712
+ expect(problems).to have(2).problem
713
+ end
714
+
715
+ it 'should create a warning on line 3' do
716
+ expect(problems).to contain_warning(class_msg % :bar).on_line(3).in_column(10)
717
+ end
718
+
719
+ it 'should create a warning on line 4' do
720
+ expect(problems).to contain_warning(class_msg % :bar).on_line(4).in_column(10)
721
+ end
722
+ end
723
+
724
+ context 'class with parameters documented twice ([*bar*])' do
725
+ let(:code) do
726
+ <<-EOS.gsub(/^\s+/, '')
727
+ # @summary Example class
728
+ #
729
+ # @param bar
730
+ # example
731
+ # @param foo example
732
+ # [*bar*] Duplicate/conflicting docs
733
+ #
734
+ class example($foo, $bar) { }
735
+ EOS
736
+ end
737
+
738
+ it 'should detect two problems' do
739
+ expect(problems).to have(2).problem
740
+ end
741
+
742
+ it 'should create a warning on line 3' do
743
+ expect(problems).to contain_warning(class_msg % :bar).on_line(3).in_column(10)
744
+ end
745
+
746
+ it 'should create a warning on line 6' do
747
+ expect(problems).to contain_warning(class_msg % :bar).on_line(6).in_column(3)
748
+ end
749
+ end
750
+ end
751
+
752
+ context 'class with documentation for parameters that don\'t exist' do
753
+ let(:code) do
754
+ <<-EOS.gsub(/^\s+/, '')
755
+ # @summary Example class
756
+ #
757
+ # @param foo
758
+ class example { }
759
+ EOS
760
+ end
761
+
762
+ it 'should detect a single problem' do
763
+ expect(problems).to have(1).problem
764
+ end
765
+
766
+ it 'should create a warning on line 3' do
767
+ expect(problems).to contain_warning('No matching class parameter for documentation of example::foo').on_line(3).in_column(10)
768
+ end
769
+ end
770
+
771
+ context 'private class with documentation for parameters that don\'t exist' do
772
+ let(:code) do
773
+ <<-EOS.gsub(/^\s+/, '')
774
+ # @summary Example class
775
+ #
776
+ # @param foo
777
+ # Example docs
778
+ #
779
+ # @api private
780
+ class example { }
781
+ EOS
782
+ end
783
+
784
+ it 'should detect a single problem' do
785
+ expect(problems).to have(1).problem
786
+ end
787
+
788
+ it 'should create a warning on line 3' do
789
+ expect(problems).to contain_warning('No matching class parameter for documentation of example::foo').on_line(3).in_column(10)
790
+ end
791
+ end
792
+
793
+ context 'define with documentation for parameters that don\'t exist' do
794
+ let(:code) do
795
+ <<-EOS.gsub(/^\s+/, '')
796
+ # @summary Example define
797
+ #
798
+ # @param bar Docs for bar
799
+ # @param foo
800
+ # Docs for foo
801
+ #
802
+ # @api private
803
+ define example::example(String[1] $bar) { }
804
+ EOS
805
+ end
806
+
807
+ it 'should detect a single problem' do
808
+ expect(problems).to have(1).problem
809
+ end
810
+
811
+ it 'should create a warning on line 4' do
812
+ expect(problems).to contain_warning('No matching defined type parameter for documentation of example::example::foo').on_line(4).in_column(10)
813
+ end
814
+ end
815
+
816
+ context 'define with documentation for parameter `name`' do
817
+ let(:code) do
818
+ <<-EOS.gsub(/^\s+/, '')
819
+ # @summary Example define
820
+ #
821
+ # @param name
822
+ # Docs for the $name
823
+ # @param bar Docs for bar
824
+ define example::example(String[1] $bar) { }
825
+ EOS
826
+ end
827
+
828
+ it 'should not detect any problems' do
829
+ expect(problems).to have(0).problems
830
+ end
831
+ end
832
+
833
+ context 'class with documentation for parameter `name`' do
834
+ let(:code) do
835
+ <<-EOS.gsub(/^\s+/, '')
836
+ # @summary Example class
837
+ #
838
+ # @param name
839
+ # Invalid docs
840
+ class example { }
841
+ EOS
842
+ end
843
+
844
+ it 'should detect a single problem' do
845
+ expect(problems).to have(1).problem
846
+ end
847
+
848
+ it 'should create a warning on line 3' do
849
+ expect(problems).to contain_warning('No matching class parameter for documentation of example::name').on_line(3).in_column(10)
850
+ end
851
+ end
852
+
853
+ context 'define with documentation for parameter `title`' do
854
+ let(:code) do
855
+ <<-EOS.gsub(/^\s+/, '')
856
+ # @summary Example define
857
+ #
858
+ # @param title
859
+ # Docs for the $title
860
+ # @param bar Docs for bar
861
+ define example::example(String[1] $bar) { }
862
+ EOS
863
+ end
864
+
865
+ it 'should not detect any problems' do
866
+ expect(problems).to have(0).problems
867
+ end
868
+ end
869
+
870
+ context 'class with documentation for parameter `title`' do
871
+ let(:code) do
872
+ <<-EOS.gsub(/^\s+/, '')
873
+ # @summary Example class
874
+ #
875
+ # @param title
876
+ # Invalid docs
877
+ class example { }
878
+ EOS
879
+ end
880
+
881
+ it 'should detect a single problem' do
882
+ expect(problems).to have(1).problem
883
+ end
884
+
885
+ it 'should create a warning on line 3' do
886
+ expect(problems).to contain_warning('No matching class parameter for documentation of example::title').on_line(3).in_column(10)
887
+ end
888
+ end
889
+
890
+ context 'define with documentation for both `title` and `name`' do
891
+ let(:code) do
892
+ <<-EOS.gsub(/^\s+/, '')
893
+ # @summary Example define
894
+ #
895
+ # @param title
896
+ # Docs for the $title
897
+ # @param name
898
+ # Docs for the $name
899
+ # @param bar Docs for bar
900
+ define example(String[1] $bar) { }
901
+ EOS
902
+ end
903
+
904
+ it 'should detect two problems' do
905
+ expect(problems).to have(2).problems
906
+ end
907
+
908
+ it 'should create a warning on line 3' do
909
+ expect(problems).to contain_warning('Duplicate defined type parameter documentation for example::name/title').on_line(3).in_column(10)
910
+ end
911
+
912
+ it 'should create a warning on line 5' do
913
+ expect(problems).to contain_warning('Duplicate defined type parameter documentation for example::name/title').on_line(5).in_column(10)
914
+ end
915
+ end
547
916
  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.5.1
4
+ version: 1.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-23 00:00:00.000000000 Z
11
+ date: 2021-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet-lint
@@ -132,8 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  requirements: []
135
- rubyforge_project:
136
- rubygems_version: 2.7.7
135
+ rubygems_version: 3.1.6
137
136
  signing_key:
138
137
  specification_version: 4
139
138
  summary: puppet-lint check to validate all parameters are documented