puppet-lint 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +74 -0
- data/.rubocop_todo.yml +89 -0
- data/.travis.yml +11 -9
- data/CHANGELOG.md +54 -0
- data/Gemfile +3 -0
- data/Rakefile +14 -3
- data/appveyor.yml +1 -4
- data/bin/puppet-lint +1 -1
- data/lib/puppet-lint.rb +25 -21
- data/lib/puppet-lint/bin.rb +15 -19
- data/lib/puppet-lint/checkplugin.rb +24 -17
- data/lib/puppet-lint/checks.rb +42 -31
- data/lib/puppet-lint/configuration.rb +11 -8
- data/lib/puppet-lint/data.rb +236 -164
- data/lib/puppet-lint/lexer.rb +225 -203
- data/lib/puppet-lint/lexer/token.rb +34 -18
- data/lib/puppet-lint/optparser.rb +33 -30
- data/lib/puppet-lint/plugins.rb +42 -38
- data/lib/puppet-lint/plugins/check_classes/arrow_on_right_operand_line.rb +26 -28
- data/lib/puppet-lint/plugins/check_classes/autoloader_layout.rb +21 -20
- data/lib/puppet-lint/plugins/check_classes/class_inherits_from_params_class.rb +8 -9
- data/lib/puppet-lint/plugins/check_classes/code_on_top_scope.rb +9 -8
- data/lib/puppet-lint/plugins/check_classes/inherits_across_namespaces.rb +12 -11
- data/lib/puppet-lint/plugins/check_classes/names_containing_dash.rb +13 -12
- data/lib/puppet-lint/plugins/check_classes/names_containing_uppercase.rb +14 -13
- data/lib/puppet-lint/plugins/check_classes/nested_classes_or_defines.rb +9 -10
- data/lib/puppet-lint/plugins/check_classes/parameter_order.rb +40 -31
- data/lib/puppet-lint/plugins/check_classes/right_to_left_relationship.rb +3 -2
- data/lib/puppet-lint/plugins/check_classes/variable_scope.rb +21 -24
- data/lib/puppet-lint/plugins/check_comments/slash_comments.rb +3 -2
- data/lib/puppet-lint/plugins/check_comments/star_comments.rb +6 -5
- data/lib/puppet-lint/plugins/check_conditionals/case_without_default.rb +21 -20
- data/lib/puppet-lint/plugins/check_conditionals/selector_inside_resource.rb +10 -13
- data/lib/puppet-lint/plugins/check_documentation/documentation.rb +26 -17
- data/lib/puppet-lint/plugins/check_nodes/unquoted_node_name.rb +11 -11
- data/lib/puppet-lint/plugins/check_resources/duplicate_params.rb +4 -3
- data/lib/puppet-lint/plugins/check_resources/ensure_first_param.rb +17 -18
- data/lib/puppet-lint/plugins/check_resources/ensure_not_symlink_target.rb +17 -16
- data/lib/puppet-lint/plugins/check_resources/file_mode.rb +22 -23
- data/lib/puppet-lint/plugins/check_resources/unquoted_file_mode.rb +14 -13
- data/lib/puppet-lint/plugins/check_resources/unquoted_resource_title.rb +9 -8
- data/lib/puppet-lint/plugins/check_strings/double_quoted_strings.rb +8 -8
- data/lib/puppet-lint/plugins/check_strings/only_variable_string.rb +29 -42
- data/lib/puppet-lint/plugins/check_strings/puppet_url_without_modules.rb +5 -4
- data/lib/puppet-lint/plugins/check_strings/quoted_booleans.rb +3 -2
- data/lib/puppet-lint/plugins/check_strings/single_quote_string_with_variables.rb +4 -3
- data/lib/puppet-lint/plugins/check_strings/variables_not_enclosed.rb +3 -2
- data/lib/puppet-lint/plugins/check_variables/variable_contains_dash.rb +9 -8
- data/lib/puppet-lint/plugins/check_variables/variable_is_lowercase.rb +9 -8
- data/lib/puppet-lint/plugins/check_whitespace/140chars.rb +9 -9
- data/lib/puppet-lint/plugins/check_whitespace/2sp_soft_tabs.rb +4 -3
- data/lib/puppet-lint/plugins/check_whitespace/80chars.rb +10 -10
- data/lib/puppet-lint/plugins/check_whitespace/arrow_alignment.rb +23 -22
- data/lib/puppet-lint/plugins/check_whitespace/hard_tabs.rb +3 -2
- data/lib/puppet-lint/plugins/check_whitespace/trailing_whitespace.rb +3 -2
- data/lib/puppet-lint/tasks/puppet-lint.rb +3 -3
- data/lib/puppet-lint/version.rb +1 -1
- data/puppet-lint.gemspec +4 -4
- data/spec/puppet-lint/bin_spec.rb +268 -140
- data/spec/puppet-lint/checks_spec.rb +229 -0
- data/spec/puppet-lint/configuration_spec.rb +10 -9
- data/spec/puppet-lint/data_spec.rb +84 -0
- data/spec/puppet-lint/ignore_overrides_spec.rb +71 -40
- data/spec/puppet-lint/lexer/token_spec.rb +1 -1
- data/spec/puppet-lint/lexer_spec.rb +306 -73
- data/spec/puppet-lint/plugins/check_classes/arrow_on_right_operand_line_spec.rb +12 -6
- data/spec/puppet-lint/plugins/check_classes/autoloader_layout_spec.rb +10 -10
- data/spec/puppet-lint/plugins/check_classes/class_inherits_from_params_class_spec.rb +15 -11
- data/spec/puppet-lint/plugins/check_classes/code_on_top_scope_spec.rb +26 -21
- data/spec/puppet-lint/plugins/check_classes/inherits_across_namespaces_spec.rb +3 -3
- data/spec/puppet-lint/plugins/check_classes/name_contains_uppercase_spec.rb +4 -5
- data/spec/puppet-lint/plugins/check_classes/names_containing_dash_spec.rb +13 -0
- data/spec/puppet-lint/plugins/check_classes/nested_classes_or_defines_spec.rb +33 -25
- data/spec/puppet-lint/plugins/check_classes/parameter_order_spec.rb +80 -55
- data/spec/puppet-lint/plugins/check_classes/right_to_left_relationship_spec.rb +2 -2
- data/spec/puppet-lint/plugins/check_classes/variable_scope_spec.rb +165 -130
- data/spec/puppet-lint/plugins/check_comments/slash_comments_spec.rb +2 -2
- data/spec/puppet-lint/plugins/check_comments/star_comments_spec.rb +53 -35
- data/spec/puppet-lint/plugins/check_conditionals/case_without_default_spec.rb +59 -49
- data/spec/puppet-lint/plugins/check_conditionals/selector_inside_resource_spec.rb +18 -14
- data/spec/puppet-lint/plugins/check_documentation/documentation_spec.rb +14 -10
- data/spec/puppet-lint/plugins/check_nodes/unquoted_node_name_spec.rb +7 -7
- data/spec/puppet-lint/plugins/check_resources/duplicate_params_spec.rb +54 -44
- data/spec/puppet-lint/plugins/check_resources/ensure_first_param_spec.rb +114 -89
- data/spec/puppet-lint/plugins/check_resources/ensure_not_symlink_target_spec.rb +41 -30
- data/spec/puppet-lint/plugins/check_resources/file_mode_spec.rb +46 -40
- data/spec/puppet-lint/plugins/check_resources/unquoted_file_mode_spec.rb +46 -40
- data/spec/puppet-lint/plugins/check_resources/unquoted_resource_title_spec.rb +95 -71
- data/spec/puppet-lint/plugins/check_strings/double_quoted_strings_spec.rb +28 -24
- data/spec/puppet-lint/plugins/check_strings/only_variable_string_spec.rb +11 -9
- data/spec/puppet-lint/plugins/check_strings/puppet_url_without_modules_spec.rb +1 -2
- data/spec/puppet-lint/plugins/check_strings/single_quote_string_with_variables_spec.rb +18 -14
- data/spec/puppet-lint/plugins/check_variables/variable_contains_dash_spec.rb +1 -1
- data/spec/puppet-lint/plugins/check_variables/variable_is_lowercase_spec.rb +1 -1
- data/spec/puppet-lint/plugins/check_whitespace/140chars_spec.rb +22 -15
- data/spec/puppet-lint/plugins/check_whitespace/2sp_soft_tabs_spec.rb +8 -6
- data/spec/puppet-lint/plugins/check_whitespace/80chars_spec.rb +23 -29
- data/spec/puppet-lint/plugins/check_whitespace/arrow_alignment_spec.rb +588 -494
- data/spec/puppet-lint/plugins/check_whitespace/hard_tabs_spec.rb +1 -1
- data/spec/puppet-lint/plugins/check_whitespace/trailing_whitespace_spec.rb +27 -19
- data/spec/puppet-lint_spec.rb +2 -12
- data/spec/spec_helper.rb +35 -30
- metadata +6 -5
- data/lib/puppet-lint/monkeypatches.rb +0 -2
- data/lib/puppet-lint/monkeypatches/string_percent.rb +0 -52
- data/lib/puppet-lint/monkeypatches/string_prepend.rb +0 -13
@@ -4,7 +4,7 @@ describe 'right_to_left_relationship' do
|
|
4
4
|
let(:msg) { 'right-to-left (<-) relationship' }
|
5
5
|
|
6
6
|
context 'chain 2 resources left to right' do
|
7
|
-
let(:code) {
|
7
|
+
let(:code) { 'Class[foo] -> Class[bar]' }
|
8
8
|
|
9
9
|
it 'should not detect any problems' do
|
10
10
|
expect(problems).to have(0).problems
|
@@ -12,7 +12,7 @@ describe 'right_to_left_relationship' do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
context 'chain 2 resources right to left' do
|
15
|
-
let(:code) {
|
15
|
+
let(:code) { 'Class[foo] <- Class[bar]' }
|
16
16
|
|
17
17
|
it 'should only detect a single problem' do
|
18
18
|
expect(problems).to have(1).problem
|
@@ -4,27 +4,31 @@ describe 'variable_scope' do
|
|
4
4
|
let(:msg) { 'top-scope variable being used without an explicit namespace' }
|
5
5
|
|
6
6
|
context 'class with no variables declared accessing top scope' do
|
7
|
-
let(:code)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
let(:code) do
|
8
|
+
<<-END
|
9
|
+
class foo {
|
10
|
+
$bar = $baz
|
11
|
+
}
|
12
|
+
END
|
13
|
+
end
|
12
14
|
|
13
15
|
it 'should only detect a single problem' do
|
14
16
|
expect(problems).to have(1).problem
|
15
17
|
end
|
16
18
|
|
17
19
|
it 'should create a warning' do
|
18
|
-
expect(problems).to contain_warning(msg).on_line(
|
20
|
+
expect(problems).to contain_warning(msg).on_line(2).in_column(18)
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
22
24
|
context 'class with no variables declared accessing top scope explicitly' do
|
23
|
-
let(:code)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
let(:code) do
|
26
|
+
<<-END
|
27
|
+
class foo {
|
28
|
+
$bar = $::baz
|
29
|
+
}
|
30
|
+
END
|
31
|
+
end
|
28
32
|
|
29
33
|
it 'should not detect any problems' do
|
30
34
|
expect(problems).to have(0).problems
|
@@ -32,12 +36,14 @@ describe 'variable_scope' do
|
|
32
36
|
end
|
33
37
|
|
34
38
|
context 'class with no variables declared accessing local array index' do
|
35
|
-
let(:code)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
let(:code) do
|
40
|
+
<<-END
|
41
|
+
class foo {
|
42
|
+
$bar = ['one', 'two', 'three']
|
43
|
+
$baz = $bar[1]
|
44
|
+
}
|
45
|
+
END
|
46
|
+
end
|
41
47
|
|
42
48
|
it 'should not detect any problems' do
|
43
49
|
expect(problems).to have(0).problems
|
@@ -45,30 +51,33 @@ describe 'variable_scope' do
|
|
45
51
|
end
|
46
52
|
|
47
53
|
context 'class with no variables declared accessing local hash key' do
|
48
|
-
let(:code)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
+
let(:code) do
|
55
|
+
<<-END
|
56
|
+
class foo {
|
57
|
+
$bar = {
|
58
|
+
'one' => 1,
|
59
|
+
'two' => 2,
|
60
|
+
'three' => 3,
|
61
|
+
}
|
62
|
+
$baz = $bar['two']
|
54
63
|
}
|
55
|
-
|
56
|
-
|
57
|
-
}
|
64
|
+
END
|
65
|
+
end
|
58
66
|
|
59
67
|
it 'should not detect any problems' do
|
60
68
|
expect(problems).to have(0).problems
|
61
69
|
end
|
62
70
|
end
|
63
71
|
|
64
|
-
|
65
72
|
context 'class with variables declared accessing local scope' do
|
66
|
-
let(:code)
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
73
|
+
let(:code) do
|
74
|
+
<<-END
|
75
|
+
class foo {
|
76
|
+
$bar = 1
|
77
|
+
$baz = $bar
|
78
|
+
}
|
79
|
+
END
|
80
|
+
end
|
72
81
|
|
73
82
|
it 'should not detect any problems' do
|
74
83
|
expect(problems).to have(0).problems
|
@@ -76,11 +85,13 @@ describe 'variable_scope' do
|
|
76
85
|
end
|
77
86
|
|
78
87
|
context 'class with parameters accessing local scope' do
|
79
|
-
let(:code)
|
80
|
-
|
81
|
-
$
|
82
|
-
|
83
|
-
|
88
|
+
let(:code) do
|
89
|
+
<<-END
|
90
|
+
class foo($bar='UNSET') {
|
91
|
+
$baz = $bar
|
92
|
+
}
|
93
|
+
END
|
94
|
+
end
|
84
95
|
|
85
96
|
it 'should not detect any problems' do
|
86
97
|
expect(problems).to have(0).problems
|
@@ -88,27 +99,31 @@ describe 'variable_scope' do
|
|
88
99
|
end
|
89
100
|
|
90
101
|
context 'defined type with no variables declared accessing top scope' do
|
91
|
-
let(:code)
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
102
|
+
let(:code) do
|
103
|
+
<<-END
|
104
|
+
define foo() {
|
105
|
+
$bar = $fqdn
|
106
|
+
}
|
107
|
+
END
|
108
|
+
end
|
96
109
|
|
97
110
|
it 'should only detect a single problem' do
|
98
111
|
expect(problems).to have(1).problem
|
99
112
|
end
|
100
113
|
|
101
114
|
it 'should create a warning' do
|
102
|
-
expect(problems).to contain_warning(msg).on_line(
|
115
|
+
expect(problems).to contain_warning(msg).on_line(2).in_column(18)
|
103
116
|
end
|
104
117
|
end
|
105
118
|
|
106
119
|
context 'defined type with no variables declared accessing top scope explicitly' do
|
107
|
-
let(:code)
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
120
|
+
let(:code) do
|
121
|
+
<<-END
|
122
|
+
define foo() {
|
123
|
+
$bar = $::fqdn
|
124
|
+
}
|
125
|
+
END
|
126
|
+
end
|
112
127
|
|
113
128
|
it 'should not detect any problems' do
|
114
129
|
expect(problems).to have(0).problems
|
@@ -116,14 +131,16 @@ describe 'variable_scope' do
|
|
116
131
|
end
|
117
132
|
|
118
133
|
context '$name should be auto defined' do
|
119
|
-
let(:code)
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
134
|
+
let(:code) do
|
135
|
+
<<-END
|
136
|
+
define foo() {
|
137
|
+
$bar = $name
|
138
|
+
$baz = $title
|
139
|
+
$gronk = $module_name
|
140
|
+
$meep = $1
|
141
|
+
}
|
142
|
+
END
|
143
|
+
end
|
127
144
|
|
128
145
|
it 'should not detect any problems' do
|
129
146
|
expect(problems).to have(0).problems
|
@@ -131,13 +148,15 @@ describe 'variable_scope' do
|
|
131
148
|
end
|
132
149
|
|
133
150
|
context 'define with required parameter' do
|
134
|
-
let(:code)
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
151
|
+
let(:code) do
|
152
|
+
<<-END
|
153
|
+
define tomcat::base (
|
154
|
+
$max_perm_gen,
|
155
|
+
$owner = hiera('app_user'),
|
156
|
+
$system_properties = {},
|
157
|
+
) { }
|
158
|
+
END
|
159
|
+
end
|
141
160
|
|
142
161
|
it 'should not detect any problems' do
|
143
162
|
expect(problems).to have(0).problems
|
@@ -145,68 +164,74 @@ describe 'variable_scope' do
|
|
145
164
|
end
|
146
165
|
|
147
166
|
context 'future parser blocks' do
|
148
|
-
let(:code)
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
$a
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
$d
|
167
|
+
let(:code) do
|
168
|
+
<<-END
|
169
|
+
class foo() {
|
170
|
+
$foo = {1=>2, 3=>4}
|
171
|
+
$foo.each |$a, $b| {
|
172
|
+
$a # should cause no warnings
|
173
|
+
$c # top-scope variable warning
|
174
|
+
}
|
175
|
+
$b # top-scope variable warning
|
176
|
+
$foo.each |$d| {
|
177
|
+
$d[1] # should cause no warnings
|
178
|
+
}
|
158
179
|
}
|
159
|
-
|
160
|
-
|
180
|
+
END
|
181
|
+
end
|
161
182
|
|
162
183
|
it 'should only detect two problems' do
|
163
184
|
expect(problems).to have(2).problem
|
164
185
|
end
|
165
186
|
|
166
187
|
it 'should create two warnings' do
|
167
|
-
expect(problems).to contain_warning(msg).on_line(
|
168
|
-
expect(problems).to contain_warning(msg).on_line(
|
188
|
+
expect(problems).to contain_warning(msg).on_line(7).in_column(11)
|
189
|
+
expect(problems).to contain_warning(msg).on_line(5).in_column(13)
|
169
190
|
end
|
170
191
|
end
|
171
192
|
|
172
193
|
context 'nested future parser blocks' do
|
173
|
-
let(:code)
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
$k
|
179
|
-
$v
|
180
|
-
$x # top-scope warning
|
181
|
-
$bar.each |$x| {
|
194
|
+
let(:code) do
|
195
|
+
<<-END
|
196
|
+
class foo() {
|
197
|
+
$foo = {1=>2, 3=>4}
|
198
|
+
$bar = [1, 2, 3]
|
199
|
+
$foo.each |$k ,$v| {
|
182
200
|
$k
|
183
201
|
$v
|
184
|
-
$x
|
185
|
-
$
|
202
|
+
$x # top-scope warning
|
203
|
+
$bar.each |$x| {
|
204
|
+
$k
|
205
|
+
$v
|
206
|
+
$x
|
207
|
+
$p # top-scope warning
|
208
|
+
}
|
209
|
+
$x # top-scope warning
|
186
210
|
}
|
187
|
-
$x # top-scope warning
|
188
211
|
}
|
189
|
-
|
190
|
-
|
212
|
+
END
|
213
|
+
end
|
191
214
|
|
192
215
|
it 'should only detect three problems' do
|
193
216
|
expect(problems).to have(3).problem
|
194
217
|
end
|
195
218
|
|
196
219
|
it 'should create three warnings' do
|
197
|
-
expect(problems).to contain_warning(msg).on_line(
|
198
|
-
expect(problems).to contain_warning(msg).on_line(
|
199
|
-
expect(problems).to contain_warning(msg).on_line(
|
220
|
+
expect(problems).to contain_warning(msg).on_line(7).in_column(13)
|
221
|
+
expect(problems).to contain_warning(msg).on_line(12).in_column(15)
|
222
|
+
expect(problems).to contain_warning(msg).on_line(14).in_column(13)
|
200
223
|
end
|
201
224
|
end
|
202
225
|
|
203
|
-
%w
|
226
|
+
%w[alias audit before loglevel noop notify require schedule stage subscribe tag].each do |metaparam|
|
204
227
|
context "referencing #{metaparam} metaparam value as a variable" do
|
205
|
-
let(:code)
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
228
|
+
let(:code) do
|
229
|
+
<<-END
|
230
|
+
class foo() {
|
231
|
+
$#{metaparam}
|
232
|
+
}
|
233
|
+
END
|
234
|
+
end
|
210
235
|
|
211
236
|
it 'should not detect any problems' do
|
212
237
|
expect(problems).to have(0).problems
|
@@ -215,13 +240,15 @@ describe 'variable_scope' do
|
|
215
240
|
end
|
216
241
|
|
217
242
|
context 'support the use of facts and trusted facts for Puppet 3.5 onwards' do
|
218
|
-
let(:code)
|
219
|
-
|
220
|
-
|
221
|
-
|
243
|
+
let(:code) do
|
244
|
+
<<-END
|
245
|
+
class foo() {
|
246
|
+
if $facts['osfamily'] == 'redhat' or $trusted['osfamily'] == 'redhat' {
|
247
|
+
$redhat = true
|
248
|
+
}
|
222
249
|
}
|
223
|
-
|
224
|
-
|
250
|
+
END
|
251
|
+
end
|
225
252
|
|
226
253
|
it 'should not detect any problems' do
|
227
254
|
expect(problems).to have(0).problems
|
@@ -229,11 +256,13 @@ describe 'variable_scope' do
|
|
229
256
|
end
|
230
257
|
|
231
258
|
context 'multiple left hand variable assign' do
|
232
|
-
let(:code)
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
259
|
+
let(:code) do
|
260
|
+
<<-END
|
261
|
+
class test {
|
262
|
+
[$foo, $bar] = something()
|
263
|
+
}
|
264
|
+
END
|
265
|
+
end
|
237
266
|
|
238
267
|
it 'should not detect any problems' do
|
239
268
|
expect(problems).to have(0).problems
|
@@ -241,11 +270,13 @@ describe 'variable_scope' do
|
|
241
270
|
end
|
242
271
|
|
243
272
|
context 'nested variable assignment' do
|
244
|
-
let(:code)
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
273
|
+
let(:code) do
|
274
|
+
<<-END
|
275
|
+
class test {
|
276
|
+
[$foo, [[$bar, $baz], $qux]] = something()
|
277
|
+
}
|
278
|
+
END
|
279
|
+
end
|
249
280
|
|
250
281
|
it 'should not detect any problems' do
|
251
282
|
expect(problems).to have(0).problems
|
@@ -253,12 +284,14 @@ describe 'variable_scope' do
|
|
253
284
|
end
|
254
285
|
|
255
286
|
context 'function calls inside string interpolation' do
|
256
|
-
let(:code)
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
287
|
+
let(:code) do
|
288
|
+
<<-END
|
289
|
+
class test {
|
290
|
+
"${split('1,2,3', ',')}" # split is a function
|
291
|
+
"${lookup('foo::bar')}" # lookup is a function
|
292
|
+
}
|
293
|
+
END
|
294
|
+
end
|
262
295
|
|
263
296
|
it 'should not detect any problems' do
|
264
297
|
expect(problems).to have(0).problems
|
@@ -266,19 +299,21 @@ describe 'variable_scope' do
|
|
266
299
|
end
|
267
300
|
|
268
301
|
context 'variables in string interpolation' do
|
269
|
-
let(:code)
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
302
|
+
let(:code) do
|
303
|
+
<<-END
|
304
|
+
class test {
|
305
|
+
"${foo.split(',')}" # foo is a top-scope variable
|
306
|
+
"${::bar.split(',')}"
|
307
|
+
}
|
308
|
+
END
|
309
|
+
end
|
275
310
|
|
276
311
|
it 'should only detect one problem' do
|
277
312
|
expect(problems).to have(1).problems
|
278
313
|
end
|
279
314
|
|
280
315
|
it 'should create one warning' do
|
281
|
-
expect(problems).to contain_warning(msg).on_line(
|
316
|
+
expect(problems).to contain_warning(msg).on_line(2).in_column(13)
|
282
317
|
end
|
283
318
|
end
|
284
319
|
end
|