puppet-lint-unquoted_string-check 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40bb27f1ef50991d0fbdf1d76f5e4d5071e3c720
4
- data.tar.gz: f7ed70c0b3c8e374ba3f42018a2ce43d40606348
3
+ metadata.gz: 1ea22a3b0a227e64b12ee46c8b12f9337c01f4ac
4
+ data.tar.gz: 69ec7bce2e2a708ec184fb28ad98ddc2db8eb9d7
5
5
  SHA512:
6
- metadata.gz: e2266dcab6a9cfc29b5e9e9b09514106ba8fd52ed7b250b008395de1bb596f3eea96f7a5c90e618d79b161ae68963c2e8bc13e652791e370c0b07a7fe3d8978c
7
- data.tar.gz: dcbb50f022a8c71a1e093d3cd25c4b39c4f92b5e1d288c1bc1ffeaa9693fd7a8007ec9fec2ac5be4637550d86052eb8ef4ee970db3fd3ab4779c474aad1c4256
6
+ metadata.gz: 3168c4df9279fbfe9e30257cbaf8f1c8ba4749cef7382efd26ebaf41c80c4a93c8144fc69e9afb7ff915a34b6d98057c54118145afe64f00d57b31c4f02174b6
7
+ data.tar.gz: cb8efc59e01b978ccd5032918e9b702dc2b8004f979d86bd4b99751b4414965e29c29aceedb81b153cfddf6df503a4b7d5017c32e12cdc24a8ec060ae0f08db9
@@ -26,7 +26,7 @@ PuppetLint.new_check(:unquoted_string_in_case) do
26
26
  case_indexes.each do |kase|
27
27
  case_tokens = tokens[kase[:start]..kase[:end]]
28
28
 
29
- if case_tokens.index { |r| r.type == :NAME || r.type == :CLASSREF }
29
+ if case_tokens.index { |r| r.next_token.type == :COLON && (r.type == :NAME || r.type == :CLASSREF) }
30
30
  notify :warning, {
31
31
  :message => 'expected quoted string in case',
32
32
  :line => case_tokens.first.line,
@@ -26,6 +26,53 @@ describe 'unquoted_string_in_case' do
26
26
  end
27
27
  end
28
28
 
29
+ context 'quoted case containing :NAME' do
30
+ let(:code) do
31
+ <<-EOS
32
+ case $osfamily {
33
+ 'Solaris': {
34
+ include ::foo
35
+ }
36
+ /(Darwin|FreeBSD)/: {
37
+ include bar
38
+ }
39
+ default: {
40
+ $rootgroup = 'root'
41
+ }
42
+ }
43
+ EOS
44
+ end
45
+
46
+ it 'should not detect any problems' do
47
+ expect(problems).to have(0).problems
48
+ end
49
+ end
50
+
51
+ context 'quoted case containing :CLASSREF' do
52
+ let(:code) do
53
+ <<-EOS
54
+ case $osfamily {
55
+ 'Solaris': {
56
+ Foo {
57
+ bar => 'baz',
58
+ }
59
+ }
60
+ /(Darwin|FreeBSD)/: {
61
+ $rootgroup = 'wheel'
62
+ include bar
63
+ }
64
+ default: {
65
+ $rootgroup = 'root'
66
+ }
67
+ }
68
+ EOS
69
+ end
70
+
71
+ it 'should not detect any problems' do
72
+ expect(problems).to have(0).problems
73
+ end
74
+ end
75
+
29
76
  context ':NAME in case' do
30
77
  let(:code) do
31
78
  <<-EOS
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint-unquoted_string-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mickaël Canévet