puppet-lint 2.5.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +522 -0
- data/lib/puppet-lint/bin.rb +71 -6
- data/lib/puppet-lint/checkplugin.rb +43 -9
- data/lib/puppet-lint/checks.rb +16 -16
- data/lib/puppet-lint/configuration.rb +134 -134
- data/lib/puppet-lint/data.rb +28 -28
- data/lib/puppet-lint/lexer/string_slurper.rb +138 -140
- data/lib/puppet-lint/lexer/token.rb +188 -190
- data/lib/puppet-lint/lexer.rb +416 -417
- data/lib/puppet-lint/monkeypatches.rb +1 -1
- data/lib/puppet-lint/optparser.rb +5 -1
- data/lib/puppet-lint/plugins/check_classes/arrow_on_right_operand_line.rb +6 -4
- data/lib/puppet-lint/plugins/check_classes/autoloader_layout.rb +5 -3
- data/lib/puppet-lint/plugins/check_classes/class_inherits_from_params_class.rb +6 -4
- data/lib/puppet-lint/plugins/check_classes/code_on_top_scope.rb +5 -3
- data/lib/puppet-lint/plugins/check_classes/inherits_across_namespaces.rb +5 -3
- data/lib/puppet-lint/plugins/check_classes/names_containing_dash.rb +5 -3
- data/lib/puppet-lint/plugins/check_classes/names_containing_uppercase.rb +7 -5
- data/lib/puppet-lint/plugins/check_classes/nested_classes_or_defines.rb +5 -3
- data/lib/puppet-lint/plugins/check_classes/parameter_order.rb +7 -4
- data/lib/puppet-lint/plugins/check_classes/right_to_left_relationship.rb +5 -3
- data/lib/puppet-lint/plugins/check_classes/variable_scope.rb +15 -13
- data/lib/puppet-lint/plugins/check_comments/slash_comments.rb +9 -7
- data/lib/puppet-lint/plugins/check_comments/star_comments.rb +10 -8
- data/lib/puppet-lint/plugins/check_conditionals/case_without_default.rb +6 -4
- data/lib/puppet-lint/plugins/check_conditionals/selector_inside_resource.rb +5 -3
- data/lib/puppet-lint/plugins/check_documentation/documentation.rb +7 -3
- data/lib/puppet-lint/plugins/check_nodes/unquoted_node_name.rb +15 -11
- data/lib/puppet-lint/plugins/check_resources/duplicate_params.rb +5 -3
- data/lib/puppet-lint/plugins/check_resources/ensure_first_param.rb +8 -5
- data/lib/puppet-lint/plugins/check_resources/ensure_not_symlink_target.rb +11 -8
- data/lib/puppet-lint/plugins/check_resources/file_mode.rb +14 -9
- data/lib/puppet-lint/plugins/check_resources/unquoted_file_mode.rb +11 -6
- data/lib/puppet-lint/plugins/check_resources/unquoted_resource_title.rb +6 -4
- data/lib/puppet-lint/plugins/check_strings/double_quoted_strings.rb +12 -7
- data/lib/puppet-lint/plugins/check_strings/only_variable_string.rb +8 -6
- data/lib/puppet-lint/plugins/check_strings/puppet_url_without_modules.rb +14 -8
- data/lib/puppet-lint/plugins/check_strings/quoted_booleans.rb +11 -7
- data/lib/puppet-lint/plugins/check_strings/single_quote_string_with_variables.rb +11 -6
- data/lib/puppet-lint/plugins/check_strings/variables_not_enclosed.rb +12 -8
- data/lib/puppet-lint/plugins/check_variables/variable_contains_dash.rb +11 -7
- data/lib/puppet-lint/plugins/check_variables/variable_is_lowercase.rb +11 -7
- data/lib/puppet-lint/plugins/check_whitespace/140chars.rb +3 -8
- data/lib/puppet-lint/plugins/check_whitespace/2sp_soft_tabs.rb +10 -8
- data/lib/puppet-lint/plugins/check_whitespace/80chars.rb +3 -8
- data/lib/puppet-lint/plugins/check_whitespace/arrow_alignment.rb +10 -8
- data/lib/puppet-lint/plugins/check_whitespace/hard_tabs.rb +11 -7
- data/lib/puppet-lint/plugins/check_whitespace/line_length.rb +29 -0
- data/lib/puppet-lint/plugins/check_whitespace/trailing_whitespace.rb +13 -7
- data/lib/puppet-lint/plugins.rb +63 -61
- data/lib/puppet-lint/report/github.rb +17 -0
- data/lib/puppet-lint/report/sarif_template.json +63 -0
- data/lib/puppet-lint/tasks/puppet-lint.rb +84 -83
- data/lib/puppet-lint/tasks/release_test.rb +4 -1
- data/lib/puppet-lint/version.rb +1 -1
- data/lib/puppet-lint.rb +27 -12
- data/spec/acceptance/puppet_lint_spec.rb +46 -0
- data/spec/spec_helper.rb +92 -91
- data/spec/spec_helper_acceptance.rb +6 -0
- data/spec/spec_helper_acceptance_local.rb +38 -0
- data/spec/{puppet-lint → unit/puppet-lint}/bin_spec.rb +79 -35
- data/spec/{puppet-lint → unit/puppet-lint}/checks_spec.rb +36 -36
- data/spec/unit/puppet-lint/configuration_spec.rb +88 -0
- data/spec/{puppet-lint → unit/puppet-lint}/data_spec.rb +6 -3
- data/spec/{puppet-lint → unit/puppet-lint}/ignore_overrides_spec.rb +17 -17
- data/spec/{puppet-lint → unit/puppet-lint}/lexer/string_slurper_spec.rb +128 -128
- data/spec/{puppet-lint → unit/puppet-lint}/lexer/token_spec.rb +1 -1
- data/spec/{puppet-lint → unit/puppet-lint}/lexer_spec.rb +653 -671
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/arrow_on_right_operand_line_spec.rb +16 -16
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/autoloader_layout_spec.rb +13 -13
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/class_inherits_from_params_class_spec.rb +3 -3
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/code_on_top_scope_spec.rb +4 -4
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/inherits_across_namespaces_spec.rb +4 -4
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/name_contains_uppercase_spec.rb +10 -10
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/names_containing_dash_spec.rb +7 -7
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/nested_classes_or_defines_spec.rb +7 -7
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/parameter_order_spec.rb +9 -9
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/right_to_left_relationship_spec.rb +3 -3
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/variable_scope_spec.rb +25 -25
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_comments/slash_comments_spec.rb +7 -7
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_comments/star_comments_spec.rb +13 -13
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_conditionals/case_without_default_spec.rb +10 -10
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_conditionals/selector_inside_resource_spec.rb +3 -3
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_documentation/documentation_spec.rb +8 -8
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_nodes/unquoted_node_name_spec.rb +24 -24
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/duplicate_params_spec.rb +9 -9
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/ensure_first_param_spec.rb +19 -19
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/ensure_not_symlink_target_spec.rb +10 -10
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/file_mode_spec.rb +40 -40
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/unquoted_file_mode_spec.rb +20 -20
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/unquoted_resource_title_spec.rb +24 -24
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/double_quoted_strings_spec.rb +28 -27
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/only_variable_string_spec.rb +18 -18
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/puppet_url_without_modules_spec.rb +9 -9
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/quoted_booleans_spec.rb +22 -22
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/single_quote_string_with_variables_spec.rb +2 -2
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/variables_not_enclosed_spec.rb +21 -21
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_variables/variable_contains_dash_spec.rb +6 -6
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_variables/variable_is_lowercase_spec.rb +7 -7
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_whitespace/140chars_spec.rb +5 -5
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_whitespace/2sp_soft_tabs_spec.rb +2 -2
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_whitespace/80chars_spec.rb +6 -6
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_whitespace/arrow_alignment_spec.rb +127 -127
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_whitespace/hard_tabs_spec.rb +7 -7
- data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_whitespace/trailing_whitespace_spec.rb +15 -15
- data/spec/unit/puppet-lint/puppet-lint_spec.rb +18 -0
- metadata +69 -120
- data/CHANGELOG.md +0 -1130
- data/spec/puppet-lint/configuration_spec.rb +0 -66
- data/spec/puppet-lint_spec.rb +0 -16
@@ -59,10 +59,10 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
59
59
|
|
60
60
|
it 'puts the variable into an interpolation segment' do
|
61
61
|
expect(segments).to eq([
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
[:STRING, ''],
|
63
|
+
[:INTERP, 'foo'],
|
64
|
+
[:STRING, 'bar'],
|
65
|
+
])
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
@@ -71,10 +71,10 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
71
71
|
|
72
72
|
it 'puts the variable into an interpolation segment' do
|
73
73
|
expect(segments).to eq([
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
74
|
+
[:STRING, 'foo'],
|
75
|
+
[:INTERP, 'bar'],
|
76
|
+
[:STRING, 'baz'],
|
77
|
+
])
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -83,12 +83,12 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
83
83
|
|
84
84
|
it 'puts each variable into an interpolation segment' do
|
85
85
|
expect(segments).to eq([
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
86
|
+
[:STRING, 'foo'],
|
87
|
+
[:INTERP, 'bar'],
|
88
|
+
[:STRING, 'baz'],
|
89
|
+
[:INTERP, 'gronk'],
|
90
|
+
[:STRING, 'meh'],
|
91
|
+
])
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
@@ -97,10 +97,10 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
97
97
|
|
98
98
|
it 'puts empty string segments around the interpolated segment' do
|
99
99
|
expect(segments).to eq([
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
100
|
+
[:STRING, ''],
|
101
|
+
[:INTERP, 'bar'],
|
102
|
+
[:STRING, ''],
|
103
|
+
])
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
@@ -109,10 +109,10 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
109
109
|
|
110
110
|
it 'does not remove the unnecessary $' do
|
111
111
|
expect(segments).to eq([
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
112
|
+
[:STRING, ''],
|
113
|
+
[:INTERP, '$bar'],
|
114
|
+
[:STRING, ''],
|
115
|
+
])
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
@@ -121,10 +121,10 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
121
121
|
|
122
122
|
it 'includes the references in the interpolated section' do
|
123
123
|
expect(segments).to eq([
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
124
|
+
[:STRING, ''],
|
125
|
+
[:INTERP, 'foo[bar][baz]'],
|
126
|
+
[:STRING, ''],
|
127
|
+
])
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
@@ -133,12 +133,12 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
133
133
|
|
134
134
|
it 'creates an interpolation section per variable' do
|
135
135
|
expect(segments).to eq([
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
136
|
+
[:STRING, ''],
|
137
|
+
[:INTERP, 'foo'],
|
138
|
+
[:STRING, ''],
|
139
|
+
[:INTERP, 'bar'],
|
140
|
+
[:STRING, ''],
|
141
|
+
])
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
@@ -147,10 +147,10 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
147
147
|
|
148
148
|
it 'creates a special segment for the unenclosed variable' do
|
149
149
|
expect(segments).to eq([
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
150
|
+
[:STRING, ''],
|
151
|
+
[:UNENC_VAR, '$foo'],
|
152
|
+
[:STRING, ''],
|
153
|
+
])
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
@@ -159,10 +159,10 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
159
159
|
|
160
160
|
it 'creates an interpolation segment for the nested string' do
|
161
161
|
expect(segments).to eq([
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
162
|
+
[:STRING, 'string with '],
|
163
|
+
[:INTERP, "'a nested single quoted string'"],
|
164
|
+
[:STRING, ' inside it'],
|
165
|
+
])
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
@@ -171,10 +171,10 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
171
171
|
|
172
172
|
it 'creates an interpolation segment for the nested math' do
|
173
173
|
expect(segments).to eq([
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
174
|
+
[:STRING, 'string with '],
|
175
|
+
[:INTERP, '(3+5)/4'],
|
176
|
+
[:STRING, ' nested math'],
|
177
|
+
])
|
178
178
|
end
|
179
179
|
end
|
180
180
|
|
@@ -183,10 +183,10 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
183
183
|
|
184
184
|
it 'creates an interpolation segment for the nested array' do
|
185
185
|
expect(segments).to eq([
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
186
|
+
[:STRING, 'string with '],
|
187
|
+
[:INTERP, "['an array ', $v2]"],
|
188
|
+
[:STRING, ' in it'],
|
189
|
+
])
|
190
190
|
end
|
191
191
|
end
|
192
192
|
|
@@ -203,12 +203,12 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
203
203
|
|
204
204
|
it 'creates a special segment for each unenclosed variable' do
|
205
205
|
expect(segments).to eq([
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
206
|
+
[:STRING, ''],
|
207
|
+
[:UNENC_VAR, '$foo'],
|
208
|
+
[:STRING, ''],
|
209
|
+
[:UNENC_VAR, '$bar'],
|
210
|
+
[:STRING, ''],
|
211
|
+
])
|
212
212
|
end
|
213
213
|
end
|
214
214
|
|
@@ -217,10 +217,10 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
217
217
|
|
218
218
|
it 'places the trailing $ in a string segment' do
|
219
219
|
expect(segments).to eq([
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
220
|
+
[:STRING, 'foo'],
|
221
|
+
[:UNENC_VAR, '$bar'],
|
222
|
+
[:STRING, '$'],
|
223
|
+
])
|
224
224
|
end
|
225
225
|
end
|
226
226
|
|
@@ -229,10 +229,10 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
229
229
|
|
230
230
|
it 'includes the preceeding $ in the string segment before the unenclosed variable' do
|
231
231
|
expect(segments).to eq([
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
232
|
+
[:STRING, 'foo$'],
|
233
|
+
[:UNENC_VAR, '$bar'],
|
234
|
+
[:STRING, ''],
|
235
|
+
])
|
236
236
|
end
|
237
237
|
end
|
238
238
|
|
@@ -241,10 +241,10 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
241
241
|
|
242
242
|
it 'only includes the valid part of the variable name in the segment' do
|
243
243
|
expect(segments).to eq([
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
244
|
+
[:STRING, ''],
|
245
|
+
[:UNENC_VAR, '$foo'],
|
246
|
+
[:STRING, '::::bar'],
|
247
|
+
])
|
248
248
|
end
|
249
249
|
end
|
250
250
|
|
@@ -253,10 +253,10 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
253
253
|
|
254
254
|
it 'does not let this double quote terminate the string' do
|
255
255
|
expect(segments).to eq([
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
256
|
+
[:STRING, ''],
|
257
|
+
[:INTERP, 'foo'],
|
258
|
+
[:STRING, '\\"bar'],
|
259
|
+
])
|
260
260
|
end
|
261
261
|
end
|
262
262
|
|
@@ -265,10 +265,10 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
265
265
|
|
266
266
|
it 'recognizes this double quote as the terminator' do
|
267
267
|
expect(segments).to eq([
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
268
|
+
[:STRING, ''],
|
269
|
+
[:INTERP, 'foo'],
|
270
|
+
[:STRING, '\\\\'],
|
271
|
+
])
|
272
272
|
end
|
273
273
|
end
|
274
274
|
|
@@ -277,12 +277,12 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
277
277
|
|
278
278
|
it 'keeps the whole function chain in a single interpolation segment' do
|
279
279
|
expect(segments).to eq([
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
280
|
+
[:STRING, ''],
|
281
|
+
[:INTERP, 'key'],
|
282
|
+
[:STRING, ' '],
|
283
|
+
[:INTERP, 'flatten([$value]).join("\nkey ")'],
|
284
|
+
[:STRING, ''],
|
285
|
+
])
|
286
286
|
end
|
287
287
|
end
|
288
288
|
|
@@ -291,12 +291,12 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
291
291
|
|
292
292
|
it 'keeps each full interpolation in its own segment' do
|
293
293
|
expect(segments).to eq([
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
294
|
+
[:STRING, ''],
|
295
|
+
[:INTERP, 'facts["network_${iface}"]'],
|
296
|
+
[:STRING, '/'],
|
297
|
+
[:INTERP, 'facts["netmask_${iface}"]'],
|
298
|
+
[:STRING, ''],
|
299
|
+
])
|
300
300
|
end
|
301
301
|
end
|
302
302
|
|
@@ -305,10 +305,10 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
305
305
|
|
306
306
|
it do
|
307
307
|
expect(segments).to eq([
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
308
|
+
[:STRING, ''],
|
309
|
+
[:INTERP, '$foo.map |$bar| { something($bar) }'],
|
310
|
+
[:STRING, ''],
|
311
|
+
])
|
312
312
|
end
|
313
313
|
end
|
314
314
|
end
|
@@ -324,9 +324,9 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
324
324
|
|
325
325
|
it 'terminates the heredoc at the closing tag' do
|
326
326
|
expect(segments).to eq([
|
327
|
-
|
328
|
-
|
329
|
-
|
327
|
+
[:HEREDOC, " SOMETHING else\n "],
|
328
|
+
[:HEREDOC_TERM, '|-THING'],
|
329
|
+
])
|
330
330
|
end
|
331
331
|
end
|
332
332
|
|
@@ -337,9 +337,9 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
337
337
|
|
338
338
|
it 'splits the heredoc into two segments' do
|
339
339
|
expect(segments).to eq([
|
340
|
-
|
341
|
-
|
342
|
-
|
340
|
+
[:HEREDOC, " SOMETHING\n ELSE\n :\n "],
|
341
|
+
[:HEREDOC_TERM, '|-myheredoc'],
|
342
|
+
])
|
343
343
|
end
|
344
344
|
end
|
345
345
|
|
@@ -349,9 +349,9 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
349
349
|
|
350
350
|
it 'does not create an interpolation segment' do
|
351
351
|
expect(segments).to eq([
|
352
|
-
|
353
|
-
|
354
|
-
|
352
|
+
[:HEREDOC, " SOMETHING\n ${else}\n :\n "],
|
353
|
+
[:HEREDOC_TERM, '|-myheredoc'],
|
354
|
+
])
|
355
355
|
end
|
356
356
|
end
|
357
357
|
|
@@ -361,9 +361,9 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
361
361
|
|
362
362
|
it 'does not create a segment for the unenclosed variable' do
|
363
363
|
expect(segments).to eq([
|
364
|
-
|
365
|
-
|
366
|
-
|
364
|
+
[:HEREDOC, " SOMETHING\n $else\n :\n "],
|
365
|
+
[:HEREDOC_TERM, '|-myheredoc'],
|
366
|
+
])
|
367
367
|
end
|
368
368
|
end
|
369
369
|
end
|
@@ -375,9 +375,9 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
375
375
|
|
376
376
|
it 'splits the heredoc into two segments' do
|
377
377
|
expect(segments).to eq([
|
378
|
-
|
379
|
-
|
380
|
-
|
378
|
+
[:HEREDOC, " SOMETHING\n ELSE\n :\n "],
|
379
|
+
[:HEREDOC_TERM, '|-myheredoc'],
|
380
|
+
])
|
381
381
|
end
|
382
382
|
end
|
383
383
|
|
@@ -387,11 +387,11 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
387
387
|
|
388
388
|
it 'creates an interpolation segment' do
|
389
389
|
expect(segments).to eq([
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
390
|
+
[:HEREDOC, " SOMETHING\n "],
|
391
|
+
[:INTERP, 'else'],
|
392
|
+
[:HEREDOC, "\n :\n "],
|
393
|
+
[:HEREDOC_TERM, '|-myheredoc'],
|
394
|
+
])
|
395
395
|
end
|
396
396
|
end
|
397
397
|
|
@@ -401,11 +401,11 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
401
401
|
|
402
402
|
it 'does not create a segment for the unenclosed variable' do
|
403
403
|
expect(segments).to eq([
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
404
|
+
[:HEREDOC, " SOMETHING\n "],
|
405
|
+
[:UNENC_VAR, '$else'],
|
406
|
+
[:HEREDOC, "\n :\n "],
|
407
|
+
[:HEREDOC_TERM, '|-myheredoc'],
|
408
|
+
])
|
409
409
|
end
|
410
410
|
end
|
411
411
|
|
@@ -415,11 +415,11 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
415
415
|
|
416
416
|
it 'does not create a segment for the unenclosed variable' do
|
417
417
|
expect(segments).to eq([
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
418
|
+
[:HEREDOC, " SOMETHING\n "],
|
419
|
+
[:INTERP, 'facts["other_${thing}"]'],
|
420
|
+
[:HEREDOC, "\n :\n "],
|
421
|
+
[:HEREDOC_TERM, '|-myheredoc'],
|
422
|
+
])
|
423
423
|
end
|
424
424
|
end
|
425
425
|
|
@@ -429,11 +429,11 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
429
429
|
|
430
430
|
it 'does not create a segment for the unenclosed variable' do
|
431
431
|
expect(segments).to eq([
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
432
|
+
[:HEREDOC, " SOMETHING\n "],
|
433
|
+
[:INTERP, '$foo.map |$bar| { something($bar) }'],
|
434
|
+
[:HEREDOC, "\n :\n "],
|
435
|
+
[:HEREDOC_TERM, '|-myheredoc'],
|
436
|
+
])
|
437
437
|
end
|
438
438
|
end
|
439
439
|
|
@@ -443,9 +443,9 @@ describe PuppetLint::Lexer::StringSlurper do
|
|
443
443
|
|
444
444
|
it do
|
445
445
|
expect(segments).to eq([
|
446
|
-
|
447
|
-
|
448
|
-
|
446
|
+
[:HEREDOC, %( {\n "foo": "bar"\n }\n )],
|
447
|
+
[:HEREDOC_TERM, '|-end'],
|
448
|
+
])
|
449
449
|
end
|
450
450
|
end
|
451
451
|
end
|