puppet-lint-unquoted_string-check 0.1.1 → 0.1.2
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: 1ea22a3b0a227e64b12ee46c8b12f9337c01f4ac
|
4
|
+
data.tar.gz: 69ec7bce2e2a708ec184fb28ad98ddc2db8eb9d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|
data/spec/puppet-lint/plugins/check_unquoted_string_in_case/check_unquoted_string_in_case_spec.rb
CHANGED
@@ -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
|