puppet-lint-manifest_whitespace-check 0.2.7 → 0.2.9
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 +4 -4
- data/lib/puppet-lint/plugins/check_manifest_whitespace_closing_brace.rb +2 -6
- data/lib/puppet-lint/plugins/check_manifest_whitespace_opening_bracket.rb +2 -1
- data/spec/puppet-lint/plugins/manifest_whitespace_arrow_spaces_spec.rb +45 -45
- data/spec/puppet-lint/plugins/manifest_whitespace_class_header_spec.rb +63 -63
- data/spec/puppet-lint/plugins/manifest_whitespace_class_inherits_spec.rb +9 -9
- data/spec/puppet-lint/plugins/manifest_whitespace_closing_brace_spec.rb +53 -53
- data/spec/puppet-lint/plugins/manifest_whitespace_closing_bracket_spec.rb +67 -67
- data/spec/puppet-lint/plugins/manifest_whitespace_double_newline_end_of_file_spec.rb +27 -27
- data/spec/puppet-lint/plugins/manifest_whitespace_double_newline_spec.rb +9 -9
- data/spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb +5 -5
- data/spec/puppet-lint/plugins/manifest_whitespace_newline_begin_of_file_spec.rb +25 -25
- data/spec/puppet-lint/plugins/manifest_whitespace_opening_brace_spec.rb +108 -96
- data/spec/puppet-lint/plugins/manifest_whitespace_opening_bracket_spec.rb +96 -64
- data/spec/spec_helper.rb +2 -0
- metadata +9 -9
@@ -5,24 +5,40 @@ require 'spec_helper'
|
|
5
5
|
describe 'manifest_whitespace_opening_bracket_before' do
|
6
6
|
let(:opening_bracket_msg) { 'there should be a single space before an opening bracket' }
|
7
7
|
|
8
|
-
context '
|
8
|
+
context 'inside heredoc' do
|
9
9
|
let(:code) do
|
10
|
-
<<~
|
11
|
-
{
|
12
|
-
|
13
|
-
|
10
|
+
<<~CODE
|
11
|
+
class test::heredoc {
|
12
|
+
$unsupported = @("MESSAGE"/L)
|
13
|
+
This does not support ${facts['os']['name']} ${$facts['os']['release']['major']}; \
|
14
|
+
see ${support_urls['supported_platforms']} for more information\
|
15
|
+
| MESSAGE
|
16
|
+
|
17
|
+
fail($unsupported)
|
14
18
|
}
|
15
|
-
|
19
|
+
CODE
|
16
20
|
end
|
17
21
|
|
18
|
-
it '
|
22
|
+
it 'detects no problems' do
|
23
|
+
expect(problems).to be_empty
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'as value in an lambda' do
|
28
|
+
let(:code) do
|
29
|
+
<<~CODE
|
30
|
+
$result = assert_type(Array, $some_value) |$expected, $actual| { [] }
|
31
|
+
CODE
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'detects no problems' do
|
19
35
|
expect(problems).to be_empty
|
20
36
|
end
|
21
37
|
end
|
22
38
|
|
23
39
|
context 'with iterator' do
|
24
40
|
let(:code) do
|
25
|
-
<<~
|
41
|
+
<<~CODE
|
26
42
|
{
|
27
43
|
if condition {
|
28
44
|
}
|
@@ -30,46 +46,46 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
30
46
|
['ib0', 'ib1', 'ib2', 'ib3', 'pub', 'oob', '0', '184'].each |String $name| {
|
31
47
|
}
|
32
48
|
}
|
33
|
-
|
49
|
+
CODE
|
34
50
|
end
|
35
51
|
|
36
|
-
it '
|
52
|
+
it 'detects no problems' do
|
37
53
|
expect(problems).to be_empty
|
38
54
|
end
|
39
55
|
end
|
40
56
|
|
41
57
|
context 'with array key in interpolation' do
|
42
58
|
let(:code) do
|
43
|
-
<<~
|
59
|
+
<<~CODE
|
44
60
|
"${my_array['keyname']}"
|
45
|
-
|
61
|
+
CODE
|
46
62
|
end
|
47
63
|
|
48
|
-
it '
|
64
|
+
it 'detects no problems' do
|
49
65
|
expect(problems).to be_empty
|
50
66
|
end
|
51
67
|
end
|
52
68
|
|
53
69
|
context 'with multiline iterator' do
|
54
70
|
let(:code) do
|
55
|
-
<<~
|
71
|
+
<<~CODE
|
56
72
|
include my::class
|
57
73
|
|
58
74
|
[
|
59
75
|
'a',
|
60
76
|
'b',
|
61
77
|
].each |$i| { }
|
62
|
-
|
78
|
+
CODE
|
63
79
|
end
|
64
80
|
|
65
|
-
it '
|
81
|
+
it 'detects no problems' do
|
66
82
|
expect(problems).to be_empty
|
67
83
|
end
|
68
84
|
end
|
69
85
|
|
70
86
|
context 'with no spaces' do
|
71
87
|
let(:code) do
|
72
|
-
<<~
|
88
|
+
<<~CODE
|
73
89
|
# example
|
74
90
|
#
|
75
91
|
# Main class, includes all other classes.
|
@@ -87,6 +103,7 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
87
103
|
if fact["${var}"] != $var2.keys[0] {
|
88
104
|
# noop
|
89
105
|
}
|
106
|
+
$variable_customfact = $facts['customfact_name'][$variable]
|
90
107
|
|
91
108
|
$value = [{ 'key' => 'value' }]
|
92
109
|
$value2 = [
|
@@ -118,11 +135,11 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
118
135
|
}
|
119
136
|
}
|
120
137
|
}
|
121
|
-
|
138
|
+
CODE
|
122
139
|
end
|
123
140
|
|
124
141
|
context 'with fix disabled' do
|
125
|
-
it '
|
142
|
+
it 'detects 0 problems' do
|
126
143
|
expect(problems).to be_empty
|
127
144
|
end
|
128
145
|
end
|
@@ -130,15 +147,15 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
130
147
|
|
131
148
|
context 'with resource inline' do
|
132
149
|
let(:code) do
|
133
|
-
<<~
|
150
|
+
<<~CODE
|
134
151
|
package { ['pack1', 'pack2']:
|
135
152
|
ensure => present,
|
136
153
|
}
|
137
|
-
|
154
|
+
CODE
|
138
155
|
end
|
139
156
|
|
140
157
|
context 'with fix disabled' do
|
141
|
-
it '
|
158
|
+
it 'detects 0 problems' do
|
142
159
|
expect(problems).to be_empty
|
143
160
|
end
|
144
161
|
end
|
@@ -146,18 +163,18 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
146
163
|
|
147
164
|
context 'with resource next line' do
|
148
165
|
let(:code) do
|
149
|
-
<<~
|
166
|
+
<<~CODE
|
150
167
|
package {
|
151
168
|
['pack3', 'pack4']:
|
152
169
|
ensure => present;
|
153
170
|
['pack5', 'pack6']:
|
154
171
|
ensure => present;
|
155
172
|
}
|
156
|
-
|
173
|
+
CODE
|
157
174
|
end
|
158
175
|
|
159
176
|
context 'with fix disabled' do
|
160
|
-
it '
|
177
|
+
it 'detects 0 problems' do
|
161
178
|
expect(problems).to be_empty
|
162
179
|
end
|
163
180
|
end
|
@@ -165,7 +182,7 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
165
182
|
|
166
183
|
context 'with two spaces' do
|
167
184
|
let(:code) do
|
168
|
-
<<~
|
185
|
+
<<~CODE
|
169
186
|
# example
|
170
187
|
#
|
171
188
|
# Main class, includes all other classes.
|
@@ -192,15 +209,15 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
192
209
|
}
|
193
210
|
}
|
194
211
|
}
|
195
|
-
|
212
|
+
CODE
|
196
213
|
end
|
197
214
|
|
198
215
|
context 'with fix disabled' do
|
199
|
-
it '
|
216
|
+
it 'detects a 2 problems' do
|
200
217
|
expect(problems).to have(2).problems
|
201
218
|
end
|
202
219
|
|
203
|
-
it '
|
220
|
+
it 'creates a error' do
|
204
221
|
expect(problems).to contain_error(opening_bracket_msg).on_line(9).in_column(13)
|
205
222
|
end
|
206
223
|
end
|
@@ -214,17 +231,17 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
214
231
|
PuppetLint.configuration.fix = false
|
215
232
|
end
|
216
233
|
|
217
|
-
it '
|
234
|
+
it 'detects a 2 problems' do
|
218
235
|
expect(problems).to have(2).problems
|
219
236
|
end
|
220
237
|
|
221
|
-
it '
|
238
|
+
it 'creates a error' do
|
222
239
|
expect(problems).to contain_fixed(opening_bracket_msg)
|
223
240
|
end
|
224
241
|
|
225
|
-
it '
|
242
|
+
it 'removes a space' do
|
226
243
|
expect(manifest).to eq(
|
227
|
-
<<~
|
244
|
+
<<~CODE,
|
228
245
|
# example
|
229
246
|
#
|
230
247
|
# Main class, includes all other classes.
|
@@ -251,7 +268,7 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
251
268
|
}
|
252
269
|
}
|
253
270
|
}
|
254
|
-
|
271
|
+
CODE
|
255
272
|
)
|
256
273
|
end
|
257
274
|
end
|
@@ -259,7 +276,7 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
259
276
|
|
260
277
|
context 'with newline' do
|
261
278
|
let(:code) do
|
262
|
-
<<~
|
279
|
+
<<~CODE
|
263
280
|
# example
|
264
281
|
#
|
265
282
|
# Main class, includes all other classes.
|
@@ -289,19 +306,19 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
289
306
|
}
|
290
307
|
}
|
291
308
|
}
|
292
|
-
|
309
|
+
CODE
|
293
310
|
end
|
294
311
|
|
295
312
|
context 'with fix disabled' do
|
296
|
-
it '
|
313
|
+
it 'detects a no problems' do
|
297
314
|
expect(problems).to be_empty
|
298
315
|
end
|
299
316
|
end
|
300
317
|
end
|
301
318
|
|
302
|
-
context 'with comment' do
|
319
|
+
context 'with comment 1' do
|
303
320
|
let(:code) do
|
304
|
-
<<~
|
321
|
+
<<~CODE
|
305
322
|
# example
|
306
323
|
#
|
307
324
|
# Main class, includes all other classes.
|
@@ -330,15 +347,30 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
330
347
|
}
|
331
348
|
}
|
332
349
|
}
|
333
|
-
|
350
|
+
CODE
|
334
351
|
end
|
335
352
|
|
336
353
|
context 'with fix disabled' do
|
337
|
-
it '
|
354
|
+
it 'detects a no problems' do
|
338
355
|
expect(problems).to be_empty
|
339
356
|
end
|
340
357
|
end
|
341
358
|
end
|
359
|
+
|
360
|
+
context 'with comment 2' do
|
361
|
+
let(:code) do
|
362
|
+
<<~CODE
|
363
|
+
{
|
364
|
+
# some generic comment
|
365
|
+
['some', 'values']
|
366
|
+
}
|
367
|
+
CODE
|
368
|
+
end
|
369
|
+
|
370
|
+
it 'detects no problems' do
|
371
|
+
expect(problems).to be_empty
|
372
|
+
end
|
373
|
+
end
|
342
374
|
end
|
343
375
|
|
344
376
|
describe 'manifest_whitespace_opening_bracket_after' do
|
@@ -346,23 +378,23 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
346
378
|
|
347
379
|
context 'with iterator' do
|
348
380
|
let(:code) do
|
349
|
-
<<~
|
381
|
+
<<~CODE
|
350
382
|
['ib0', 'ib1', 'ib2', 'ib3', 'pub', 'oob', '0', '184'].each |String $name| {
|
351
383
|
}
|
352
384
|
|
353
385
|
['ib0', 'ib1', 'ib2', 'ib3', 'pub', 'oob', '0', '184'].each |String $name| {
|
354
386
|
}
|
355
|
-
|
387
|
+
CODE
|
356
388
|
end
|
357
389
|
|
358
|
-
it '
|
390
|
+
it 'detects no problems' do
|
359
391
|
expect(problems).to be_empty
|
360
392
|
end
|
361
393
|
end
|
362
394
|
|
363
395
|
context 'with a single space' do
|
364
396
|
let(:code) do
|
365
|
-
<<~
|
397
|
+
<<~CODE
|
366
398
|
# example
|
367
399
|
#
|
368
400
|
# Main class, includes all other classes.
|
@@ -392,15 +424,15 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
392
424
|
}
|
393
425
|
}
|
394
426
|
}
|
395
|
-
|
427
|
+
CODE
|
396
428
|
end
|
397
429
|
|
398
430
|
context 'with fix disabled' do
|
399
|
-
it '
|
431
|
+
it 'detects 4 problems' do
|
400
432
|
expect(problems).to have(4).problem
|
401
433
|
end
|
402
434
|
|
403
|
-
it '
|
435
|
+
it 'creates a error' do
|
404
436
|
expect(problems).to contain_error(opening_bracket_msg).on_line(9).in_column(13)
|
405
437
|
end
|
406
438
|
end
|
@@ -414,13 +446,13 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
414
446
|
PuppetLint.configuration.fix = false
|
415
447
|
end
|
416
448
|
|
417
|
-
it '
|
449
|
+
it 'creates a error' do
|
418
450
|
expect(problems).to contain_fixed(opening_bracket_msg)
|
419
451
|
end
|
420
452
|
|
421
|
-
it '
|
453
|
+
it 'adds spaces' do
|
422
454
|
expect(manifest).to eq(
|
423
|
-
<<~
|
455
|
+
<<~CODE,
|
424
456
|
# example
|
425
457
|
#
|
426
458
|
# Main class, includes all other classes.
|
@@ -450,7 +482,7 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
450
482
|
}
|
451
483
|
}
|
452
484
|
}
|
453
|
-
|
485
|
+
CODE
|
454
486
|
)
|
455
487
|
end
|
456
488
|
end
|
@@ -458,7 +490,7 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
458
490
|
|
459
491
|
context 'with no spaces' do
|
460
492
|
let(:code) do
|
461
|
-
<<~
|
493
|
+
<<~CODE
|
462
494
|
# example
|
463
495
|
#
|
464
496
|
# Main class, includes all other classes.
|
@@ -485,11 +517,11 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
485
517
|
}
|
486
518
|
}
|
487
519
|
}
|
488
|
-
|
520
|
+
CODE
|
489
521
|
end
|
490
522
|
|
491
523
|
context 'with fix disabled' do
|
492
|
-
it '
|
524
|
+
it 'detects 0 problems' do
|
493
525
|
expect(problems).to be_empty
|
494
526
|
end
|
495
527
|
end
|
@@ -497,7 +529,7 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
497
529
|
|
498
530
|
context 'with two newlines' do
|
499
531
|
let(:code) do
|
500
|
-
<<~
|
532
|
+
<<~CODE
|
501
533
|
# example
|
502
534
|
#
|
503
535
|
# Main class, includes all other classes.
|
@@ -530,15 +562,15 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
530
562
|
}
|
531
563
|
}
|
532
564
|
}
|
533
|
-
|
565
|
+
CODE
|
534
566
|
end
|
535
567
|
|
536
568
|
context 'with fix disabled' do
|
537
|
-
it '
|
569
|
+
it 'detects 1 problems' do
|
538
570
|
expect(problems).to have(1).problem
|
539
571
|
end
|
540
572
|
|
541
|
-
it '
|
573
|
+
it 'creates a error' do
|
542
574
|
expect(problems).to contain_error(opening_bracket_msg).on_line(12).in_column(1)
|
543
575
|
end
|
544
576
|
end
|
@@ -552,17 +584,17 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
552
584
|
PuppetLint.configuration.fix = false
|
553
585
|
end
|
554
586
|
|
555
|
-
it '
|
587
|
+
it 'detects 1 problems' do
|
556
588
|
expect(problems).to have(1).problem
|
557
589
|
end
|
558
590
|
|
559
|
-
it '
|
591
|
+
it 'creates a error' do
|
560
592
|
expect(problems).to contain_fixed(opening_bracket_msg)
|
561
593
|
end
|
562
594
|
|
563
|
-
it '
|
595
|
+
it 'adds spaces' do
|
564
596
|
expect(manifest).to eq(
|
565
|
-
<<~
|
597
|
+
<<~CODE,
|
566
598
|
# example
|
567
599
|
#
|
568
600
|
# Main class, includes all other classes.
|
@@ -594,7 +626,7 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
594
626
|
}
|
595
627
|
}
|
596
628
|
}
|
597
|
-
|
629
|
+
CODE
|
598
630
|
)
|
599
631
|
end
|
600
632
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-lint-manifest_whitespace-check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jo Vandeginste
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puppet-lint
|
@@ -114,8 +114,8 @@ dependencies:
|
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '1.0'
|
117
|
-
description:
|
118
|
-
in manifests
|
117
|
+
description: A new check for puppet-lint that validates generic whitespace issues
|
118
|
+
in manifests.
|
119
119
|
email: jo.vandeginste@kuleuven.be
|
120
120
|
executables: []
|
121
121
|
extensions: []
|
@@ -151,7 +151,7 @@ licenses:
|
|
151
151
|
- MIT
|
152
152
|
metadata:
|
153
153
|
rubygems_mfa_required: 'true'
|
154
|
-
post_install_message:
|
154
|
+
post_install_message:
|
155
155
|
rdoc_options: []
|
156
156
|
require_paths:
|
157
157
|
- lib
|
@@ -159,15 +159,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
159
159
|
requirements:
|
160
160
|
- - ">="
|
161
161
|
- !ruby/object:Gem::Version
|
162
|
-
version: '2.
|
162
|
+
version: '2.4'
|
163
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
164
|
requirements:
|
165
165
|
- - ">="
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
168
|
requirements: []
|
169
|
-
rubygems_version: 3.3.
|
170
|
-
signing_key:
|
169
|
+
rubygems_version: 3.3.5
|
170
|
+
signing_key:
|
171
171
|
specification_version: 4
|
172
172
|
summary: A puppet-lint check to validate whitespace in manifests
|
173
173
|
test_files: []
|