puppet-lint-manifest_whitespace-check 0.2.8 → 0.3.0
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 +20 -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 +126 -100
- data/spec/puppet-lint/plugins/manifest_whitespace_opening_bracket_spec.rb +80 -68
- data/spec/spec_helper.rb +2 -0
- metadata +11 -11
@@ -7,7 +7,7 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
7
7
|
|
8
8
|
context 'inside heredoc' do
|
9
9
|
let(:code) do
|
10
|
-
<<~
|
10
|
+
<<~CODE
|
11
11
|
class test::heredoc {
|
12
12
|
$unsupported = @("MESSAGE"/L)
|
13
13
|
This does not support ${facts['os']['name']} ${$facts['os']['release']['major']}; \
|
@@ -16,32 +16,29 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
16
16
|
|
17
17
|
fail($unsupported)
|
18
18
|
}
|
19
|
-
|
19
|
+
CODE
|
20
20
|
end
|
21
21
|
|
22
|
-
it '
|
22
|
+
it 'detects no problems' do
|
23
23
|
expect(problems).to be_empty
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
context '
|
27
|
+
context 'as value in an lambda' do
|
28
28
|
let(:code) do
|
29
|
-
<<~
|
30
|
-
{
|
31
|
-
|
32
|
-
['some', 'values']
|
33
|
-
}
|
34
|
-
EOF
|
29
|
+
<<~CODE
|
30
|
+
$result = assert_type(Array, $some_value) |$expected, $actual| { [] }
|
31
|
+
CODE
|
35
32
|
end
|
36
33
|
|
37
|
-
it '
|
34
|
+
it 'detects no problems' do
|
38
35
|
expect(problems).to be_empty
|
39
36
|
end
|
40
37
|
end
|
41
38
|
|
42
39
|
context 'with iterator' do
|
43
40
|
let(:code) do
|
44
|
-
<<~
|
41
|
+
<<~CODE
|
45
42
|
{
|
46
43
|
if condition {
|
47
44
|
}
|
@@ -49,46 +46,46 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
49
46
|
['ib0', 'ib1', 'ib2', 'ib3', 'pub', 'oob', '0', '184'].each |String $name| {
|
50
47
|
}
|
51
48
|
}
|
52
|
-
|
49
|
+
CODE
|
53
50
|
end
|
54
51
|
|
55
|
-
it '
|
52
|
+
it 'detects no problems' do
|
56
53
|
expect(problems).to be_empty
|
57
54
|
end
|
58
55
|
end
|
59
56
|
|
60
57
|
context 'with array key in interpolation' do
|
61
58
|
let(:code) do
|
62
|
-
<<~
|
59
|
+
<<~CODE
|
63
60
|
"${my_array['keyname']}"
|
64
|
-
|
61
|
+
CODE
|
65
62
|
end
|
66
63
|
|
67
|
-
it '
|
64
|
+
it 'detects no problems' do
|
68
65
|
expect(problems).to be_empty
|
69
66
|
end
|
70
67
|
end
|
71
68
|
|
72
69
|
context 'with multiline iterator' do
|
73
70
|
let(:code) do
|
74
|
-
<<~
|
71
|
+
<<~CODE
|
75
72
|
include my::class
|
76
73
|
|
77
74
|
[
|
78
75
|
'a',
|
79
76
|
'b',
|
80
77
|
].each |$i| { }
|
81
|
-
|
78
|
+
CODE
|
82
79
|
end
|
83
80
|
|
84
|
-
it '
|
81
|
+
it 'detects no problems' do
|
85
82
|
expect(problems).to be_empty
|
86
83
|
end
|
87
84
|
end
|
88
85
|
|
89
86
|
context 'with no spaces' do
|
90
87
|
let(:code) do
|
91
|
-
<<~
|
88
|
+
<<~CODE
|
92
89
|
# example
|
93
90
|
#
|
94
91
|
# Main class, includes all other classes.
|
@@ -138,11 +135,11 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
138
135
|
}
|
139
136
|
}
|
140
137
|
}
|
141
|
-
|
138
|
+
CODE
|
142
139
|
end
|
143
140
|
|
144
141
|
context 'with fix disabled' do
|
145
|
-
it '
|
142
|
+
it 'detects 0 problems' do
|
146
143
|
expect(problems).to be_empty
|
147
144
|
end
|
148
145
|
end
|
@@ -150,15 +147,15 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
150
147
|
|
151
148
|
context 'with resource inline' do
|
152
149
|
let(:code) do
|
153
|
-
<<~
|
150
|
+
<<~CODE
|
154
151
|
package { ['pack1', 'pack2']:
|
155
152
|
ensure => present,
|
156
153
|
}
|
157
|
-
|
154
|
+
CODE
|
158
155
|
end
|
159
156
|
|
160
157
|
context 'with fix disabled' do
|
161
|
-
it '
|
158
|
+
it 'detects 0 problems' do
|
162
159
|
expect(problems).to be_empty
|
163
160
|
end
|
164
161
|
end
|
@@ -166,18 +163,18 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
166
163
|
|
167
164
|
context 'with resource next line' do
|
168
165
|
let(:code) do
|
169
|
-
<<~
|
166
|
+
<<~CODE
|
170
167
|
package {
|
171
168
|
['pack3', 'pack4']:
|
172
169
|
ensure => present;
|
173
170
|
['pack5', 'pack6']:
|
174
171
|
ensure => present;
|
175
172
|
}
|
176
|
-
|
173
|
+
CODE
|
177
174
|
end
|
178
175
|
|
179
176
|
context 'with fix disabled' do
|
180
|
-
it '
|
177
|
+
it 'detects 0 problems' do
|
181
178
|
expect(problems).to be_empty
|
182
179
|
end
|
183
180
|
end
|
@@ -185,7 +182,7 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
185
182
|
|
186
183
|
context 'with two spaces' do
|
187
184
|
let(:code) do
|
188
|
-
<<~
|
185
|
+
<<~CODE
|
189
186
|
# example
|
190
187
|
#
|
191
188
|
# Main class, includes all other classes.
|
@@ -212,15 +209,15 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
212
209
|
}
|
213
210
|
}
|
214
211
|
}
|
215
|
-
|
212
|
+
CODE
|
216
213
|
end
|
217
214
|
|
218
215
|
context 'with fix disabled' do
|
219
|
-
it '
|
216
|
+
it 'detects a 2 problems' do
|
220
217
|
expect(problems).to have(2).problems
|
221
218
|
end
|
222
219
|
|
223
|
-
it '
|
220
|
+
it 'creates a error' do
|
224
221
|
expect(problems).to contain_error(opening_bracket_msg).on_line(9).in_column(13)
|
225
222
|
end
|
226
223
|
end
|
@@ -234,17 +231,17 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
234
231
|
PuppetLint.configuration.fix = false
|
235
232
|
end
|
236
233
|
|
237
|
-
it '
|
234
|
+
it 'detects a 2 problems' do
|
238
235
|
expect(problems).to have(2).problems
|
239
236
|
end
|
240
237
|
|
241
|
-
it '
|
238
|
+
it 'creates a error' do
|
242
239
|
expect(problems).to contain_fixed(opening_bracket_msg)
|
243
240
|
end
|
244
241
|
|
245
|
-
it '
|
242
|
+
it 'removes a space' do
|
246
243
|
expect(manifest).to eq(
|
247
|
-
<<~
|
244
|
+
<<~CODE,
|
248
245
|
# example
|
249
246
|
#
|
250
247
|
# Main class, includes all other classes.
|
@@ -271,7 +268,7 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
271
268
|
}
|
272
269
|
}
|
273
270
|
}
|
274
|
-
|
271
|
+
CODE
|
275
272
|
)
|
276
273
|
end
|
277
274
|
end
|
@@ -279,7 +276,7 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
279
276
|
|
280
277
|
context 'with newline' do
|
281
278
|
let(:code) do
|
282
|
-
<<~
|
279
|
+
<<~CODE
|
283
280
|
# example
|
284
281
|
#
|
285
282
|
# Main class, includes all other classes.
|
@@ -309,19 +306,19 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
309
306
|
}
|
310
307
|
}
|
311
308
|
}
|
312
|
-
|
309
|
+
CODE
|
313
310
|
end
|
314
311
|
|
315
312
|
context 'with fix disabled' do
|
316
|
-
it '
|
313
|
+
it 'detects a no problems' do
|
317
314
|
expect(problems).to be_empty
|
318
315
|
end
|
319
316
|
end
|
320
317
|
end
|
321
318
|
|
322
|
-
context 'with comment' do
|
319
|
+
context 'with comment 1' do
|
323
320
|
let(:code) do
|
324
|
-
<<~
|
321
|
+
<<~CODE
|
325
322
|
# example
|
326
323
|
#
|
327
324
|
# Main class, includes all other classes.
|
@@ -350,15 +347,30 @@ describe 'manifest_whitespace_opening_bracket_before' do
|
|
350
347
|
}
|
351
348
|
}
|
352
349
|
}
|
353
|
-
|
350
|
+
CODE
|
354
351
|
end
|
355
352
|
|
356
353
|
context 'with fix disabled' do
|
357
|
-
it '
|
354
|
+
it 'detects a no problems' do
|
358
355
|
expect(problems).to be_empty
|
359
356
|
end
|
360
357
|
end
|
361
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
|
362
374
|
end
|
363
375
|
|
364
376
|
describe 'manifest_whitespace_opening_bracket_after' do
|
@@ -366,23 +378,23 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
366
378
|
|
367
379
|
context 'with iterator' do
|
368
380
|
let(:code) do
|
369
|
-
<<~
|
381
|
+
<<~CODE
|
370
382
|
['ib0', 'ib1', 'ib2', 'ib3', 'pub', 'oob', '0', '184'].each |String $name| {
|
371
383
|
}
|
372
384
|
|
373
385
|
['ib0', 'ib1', 'ib2', 'ib3', 'pub', 'oob', '0', '184'].each |String $name| {
|
374
386
|
}
|
375
|
-
|
387
|
+
CODE
|
376
388
|
end
|
377
389
|
|
378
|
-
it '
|
390
|
+
it 'detects no problems' do
|
379
391
|
expect(problems).to be_empty
|
380
392
|
end
|
381
393
|
end
|
382
394
|
|
383
395
|
context 'with a single space' do
|
384
396
|
let(:code) do
|
385
|
-
<<~
|
397
|
+
<<~CODE
|
386
398
|
# example
|
387
399
|
#
|
388
400
|
# Main class, includes all other classes.
|
@@ -412,15 +424,15 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
412
424
|
}
|
413
425
|
}
|
414
426
|
}
|
415
|
-
|
427
|
+
CODE
|
416
428
|
end
|
417
429
|
|
418
430
|
context 'with fix disabled' do
|
419
|
-
it '
|
431
|
+
it 'detects 4 problems' do
|
420
432
|
expect(problems).to have(4).problem
|
421
433
|
end
|
422
434
|
|
423
|
-
it '
|
435
|
+
it 'creates a error' do
|
424
436
|
expect(problems).to contain_error(opening_bracket_msg).on_line(9).in_column(13)
|
425
437
|
end
|
426
438
|
end
|
@@ -434,13 +446,13 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
434
446
|
PuppetLint.configuration.fix = false
|
435
447
|
end
|
436
448
|
|
437
|
-
it '
|
449
|
+
it 'creates a error' do
|
438
450
|
expect(problems).to contain_fixed(opening_bracket_msg)
|
439
451
|
end
|
440
452
|
|
441
|
-
it '
|
453
|
+
it 'adds spaces' do
|
442
454
|
expect(manifest).to eq(
|
443
|
-
<<~
|
455
|
+
<<~CODE,
|
444
456
|
# example
|
445
457
|
#
|
446
458
|
# Main class, includes all other classes.
|
@@ -470,7 +482,7 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
470
482
|
}
|
471
483
|
}
|
472
484
|
}
|
473
|
-
|
485
|
+
CODE
|
474
486
|
)
|
475
487
|
end
|
476
488
|
end
|
@@ -478,7 +490,7 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
478
490
|
|
479
491
|
context 'with no spaces' do
|
480
492
|
let(:code) do
|
481
|
-
<<~
|
493
|
+
<<~CODE
|
482
494
|
# example
|
483
495
|
#
|
484
496
|
# Main class, includes all other classes.
|
@@ -505,11 +517,11 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
505
517
|
}
|
506
518
|
}
|
507
519
|
}
|
508
|
-
|
520
|
+
CODE
|
509
521
|
end
|
510
522
|
|
511
523
|
context 'with fix disabled' do
|
512
|
-
it '
|
524
|
+
it 'detects 0 problems' do
|
513
525
|
expect(problems).to be_empty
|
514
526
|
end
|
515
527
|
end
|
@@ -517,7 +529,7 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
517
529
|
|
518
530
|
context 'with two newlines' do
|
519
531
|
let(:code) do
|
520
|
-
<<~
|
532
|
+
<<~CODE
|
521
533
|
# example
|
522
534
|
#
|
523
535
|
# Main class, includes all other classes.
|
@@ -550,15 +562,15 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
550
562
|
}
|
551
563
|
}
|
552
564
|
}
|
553
|
-
|
565
|
+
CODE
|
554
566
|
end
|
555
567
|
|
556
568
|
context 'with fix disabled' do
|
557
|
-
it '
|
569
|
+
it 'detects 1 problems' do
|
558
570
|
expect(problems).to have(1).problem
|
559
571
|
end
|
560
572
|
|
561
|
-
it '
|
573
|
+
it 'creates a error' do
|
562
574
|
expect(problems).to contain_error(opening_bracket_msg).on_line(12).in_column(1)
|
563
575
|
end
|
564
576
|
end
|
@@ -572,17 +584,17 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
572
584
|
PuppetLint.configuration.fix = false
|
573
585
|
end
|
574
586
|
|
575
|
-
it '
|
587
|
+
it 'detects 1 problems' do
|
576
588
|
expect(problems).to have(1).problem
|
577
589
|
end
|
578
590
|
|
579
|
-
it '
|
591
|
+
it 'creates a error' do
|
580
592
|
expect(problems).to contain_fixed(opening_bracket_msg)
|
581
593
|
end
|
582
594
|
|
583
|
-
it '
|
595
|
+
it 'adds spaces' do
|
584
596
|
expect(manifest).to eq(
|
585
|
-
<<~
|
597
|
+
<<~CODE,
|
586
598
|
# example
|
587
599
|
#
|
588
600
|
# Main class, includes all other classes.
|
@@ -614,7 +626,7 @@ describe 'manifest_whitespace_opening_bracket_after' do
|
|
614
626
|
}
|
615
627
|
}
|
616
628
|
}
|
617
|
-
|
629
|
+
CODE
|
618
630
|
)
|
619
631
|
end
|
620
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.
|
4
|
+
version: 0.3.0
|
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-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puppet-lint
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '1.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '5'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '1.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '5'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: coveralls
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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.
|
170
|
-
signing_key:
|
169
|
+
rubygems_version: 3.4.8
|
170
|
+
signing_key:
|
171
171
|
specification_version: 4
|
172
172
|
summary: A puppet-lint check to validate whitespace in manifests
|
173
173
|
test_files: []
|