puppet-lint-manifest_whitespace-check 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- 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 +80 -68
- data/spec/spec_helper.rb +2 -0
- metadata +5 -5
@@ -3,13 +3,13 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe 'manifest_whitespace_class_name_single_space_before' do
|
6
|
-
let(:single_space_msg)
|
6
|
+
let(:single_space_msg) do
|
7
7
|
'there should be a single space between the class or defined resource statement and the name'
|
8
|
-
|
8
|
+
end
|
9
9
|
|
10
10
|
context 'with two spaces' do
|
11
11
|
let(:code) do
|
12
|
-
<<~
|
12
|
+
<<~CODE
|
13
13
|
# example
|
14
14
|
#
|
15
15
|
# Main class, includes all other classes.
|
@@ -20,15 +20,15 @@ describe 'manifest_whitespace_class_name_single_space_before' do
|
|
20
20
|
param1 => 'value1',
|
21
21
|
}
|
22
22
|
}
|
23
|
-
|
23
|
+
CODE
|
24
24
|
end
|
25
25
|
|
26
26
|
context 'with fix disabled' do
|
27
|
-
it '
|
27
|
+
it 'detects a single problem' do
|
28
28
|
expect(problems).to have(1).problem
|
29
29
|
end
|
30
30
|
|
31
|
-
it '
|
31
|
+
it 'creates a error' do
|
32
32
|
expect(problems).to contain_error(single_space_msg).on_line(6).in_column(6)
|
33
33
|
end
|
34
34
|
end
|
@@ -42,17 +42,17 @@ describe 'manifest_whitespace_class_name_single_space_before' do
|
|
42
42
|
PuppetLint.configuration.fix = false
|
43
43
|
end
|
44
44
|
|
45
|
-
it '
|
45
|
+
it 'detects a single problem' do
|
46
46
|
expect(problems).to have(1).problem
|
47
47
|
end
|
48
48
|
|
49
|
-
it '
|
49
|
+
it 'fixes the manifest' do
|
50
50
|
expect(problems).to contain_fixed(single_space_msg)
|
51
51
|
end
|
52
52
|
|
53
|
-
it '
|
53
|
+
it 'fixes the space' do
|
54
54
|
expect(manifest).to eq(
|
55
|
-
<<~
|
55
|
+
<<~CODE,
|
56
56
|
# example
|
57
57
|
#
|
58
58
|
# Main class, includes all other classes.
|
@@ -63,7 +63,7 @@ describe 'manifest_whitespace_class_name_single_space_before' do
|
|
63
63
|
param1 => 'value1',
|
64
64
|
}
|
65
65
|
}
|
66
|
-
|
66
|
+
CODE
|
67
67
|
)
|
68
68
|
end
|
69
69
|
end
|
@@ -74,7 +74,7 @@ describe 'manifest_whitespace_class_name_single_space_before' do
|
|
74
74
|
'class example inherits otherexample {'
|
75
75
|
end
|
76
76
|
|
77
|
-
it '
|
77
|
+
it 'detects no problems' do
|
78
78
|
expect(problems).to be_empty
|
79
79
|
end
|
80
80
|
end
|
@@ -85,21 +85,21 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
85
85
|
|
86
86
|
context 'with inherits' do
|
87
87
|
let(:code) do
|
88
|
-
<<~
|
88
|
+
<<~CODE
|
89
89
|
class example inherits otherexample {
|
90
90
|
assert_private()
|
91
91
|
}
|
92
|
-
|
92
|
+
CODE
|
93
93
|
end
|
94
94
|
|
95
|
-
it '
|
95
|
+
it 'detects no problems' do
|
96
96
|
expect(problems).to be_empty
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
100
|
context 'with parameters and no spaces' do
|
101
101
|
let(:code) do
|
102
|
-
<<~
|
102
|
+
<<~CODE
|
103
103
|
# example
|
104
104
|
#
|
105
105
|
# Main class, includes all other classes.
|
@@ -112,15 +112,15 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
112
112
|
param1 => 'value1',
|
113
113
|
}
|
114
114
|
}
|
115
|
-
|
115
|
+
CODE
|
116
116
|
end
|
117
117
|
|
118
118
|
context 'with fix disabled' do
|
119
|
-
it '
|
119
|
+
it 'detects a single problem' do
|
120
120
|
expect(problems).to have(1).problem
|
121
121
|
end
|
122
122
|
|
123
|
-
it '
|
123
|
+
it 'creates a error' do
|
124
124
|
expect(problems).to contain_error(single_space_msg).on_line(6).in_column(7)
|
125
125
|
end
|
126
126
|
end
|
@@ -134,17 +134,17 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
134
134
|
PuppetLint.configuration.fix = false
|
135
135
|
end
|
136
136
|
|
137
|
-
it '
|
137
|
+
it 'detects a single problem' do
|
138
138
|
expect(problems).to have(1).problem
|
139
139
|
end
|
140
140
|
|
141
|
-
it '
|
141
|
+
it 'fixes the manifest' do
|
142
142
|
expect(problems).to contain_fixed(single_space_msg)
|
143
143
|
end
|
144
144
|
|
145
|
-
it '
|
145
|
+
it 'fixes the newline' do
|
146
146
|
expect(manifest).to eq(
|
147
|
-
<<~
|
147
|
+
<<~CODE,
|
148
148
|
# example
|
149
149
|
#
|
150
150
|
# Main class, includes all other classes.
|
@@ -157,7 +157,7 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
157
157
|
param1 => 'value1',
|
158
158
|
}
|
159
159
|
}
|
160
|
-
|
160
|
+
CODE
|
161
161
|
)
|
162
162
|
end
|
163
163
|
end
|
@@ -165,7 +165,7 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
165
165
|
|
166
166
|
context 'with scope and no spaces' do
|
167
167
|
let(:code) do
|
168
|
-
<<~
|
168
|
+
<<~CODE
|
169
169
|
# example
|
170
170
|
#
|
171
171
|
# Main class, includes all other classes.
|
@@ -176,15 +176,15 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
176
176
|
param1 => 'value1',
|
177
177
|
}
|
178
178
|
}
|
179
|
-
|
179
|
+
CODE
|
180
180
|
end
|
181
181
|
|
182
182
|
context 'with fix disabled' do
|
183
|
-
it '
|
183
|
+
it 'detects a single problem' do
|
184
184
|
expect(problems).to have(1).problem
|
185
185
|
end
|
186
186
|
|
187
|
-
it '
|
187
|
+
it 'creates a error' do
|
188
188
|
expect(problems).to contain_error(single_space_msg).on_line(6).in_column(7)
|
189
189
|
end
|
190
190
|
end
|
@@ -198,17 +198,17 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
198
198
|
PuppetLint.configuration.fix = false
|
199
199
|
end
|
200
200
|
|
201
|
-
it '
|
201
|
+
it 'detects a single problem' do
|
202
202
|
expect(problems).to have(1).problem
|
203
203
|
end
|
204
204
|
|
205
|
-
it '
|
205
|
+
it 'fixes the manifest' do
|
206
206
|
expect(problems).to contain_fixed(single_space_msg)
|
207
207
|
end
|
208
208
|
|
209
|
-
it '
|
209
|
+
it 'fixes the newline' do
|
210
210
|
expect(manifest).to eq(
|
211
|
-
<<~
|
211
|
+
<<~CODE,
|
212
212
|
# example
|
213
213
|
#
|
214
214
|
# Main class, includes all other classes.
|
@@ -219,7 +219,7 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
219
219
|
param1 => 'value1',
|
220
220
|
}
|
221
221
|
}
|
222
|
-
|
222
|
+
CODE
|
223
223
|
)
|
224
224
|
end
|
225
225
|
end
|
@@ -227,7 +227,7 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
227
227
|
|
228
228
|
context 'with no spaces' do
|
229
229
|
let(:code) do
|
230
|
-
<<~
|
230
|
+
<<~CODE
|
231
231
|
# example
|
232
232
|
#
|
233
233
|
# Main class, includes all other classes.
|
@@ -238,15 +238,15 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
238
238
|
param1 => 'value1',
|
239
239
|
}
|
240
240
|
}
|
241
|
-
|
241
|
+
CODE
|
242
242
|
end
|
243
243
|
|
244
244
|
context 'with fix disabled' do
|
245
|
-
it '
|
245
|
+
it 'detects a single problem' do
|
246
246
|
expect(problems).to have(1).problem
|
247
247
|
end
|
248
248
|
|
249
|
-
it '
|
249
|
+
it 'creates a error' do
|
250
250
|
expect(problems).to contain_error(single_space_msg).on_line(6).in_column(7)
|
251
251
|
end
|
252
252
|
end
|
@@ -260,17 +260,17 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
260
260
|
PuppetLint.configuration.fix = false
|
261
261
|
end
|
262
262
|
|
263
|
-
it '
|
263
|
+
it 'detects a single problem' do
|
264
264
|
expect(problems).to have(1).problem
|
265
265
|
end
|
266
266
|
|
267
|
-
it '
|
267
|
+
it 'fixes the manifest' do
|
268
268
|
expect(problems).to contain_fixed(single_space_msg)
|
269
269
|
end
|
270
270
|
|
271
|
-
it '
|
271
|
+
it 'fixes the newline' do
|
272
272
|
expect(manifest).to eq(
|
273
|
-
<<~
|
273
|
+
<<~CODE,
|
274
274
|
# example
|
275
275
|
#
|
276
276
|
# Main class, includes all other classes.
|
@@ -281,7 +281,7 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
281
281
|
param1 => 'value1',
|
282
282
|
}
|
283
283
|
}
|
284
|
-
|
284
|
+
CODE
|
285
285
|
)
|
286
286
|
end
|
287
287
|
end
|
@@ -289,7 +289,7 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
289
289
|
|
290
290
|
context 'with two spaces' do
|
291
291
|
let(:code) do
|
292
|
-
<<~
|
292
|
+
<<~CODE
|
293
293
|
# example
|
294
294
|
#
|
295
295
|
# Main class, includes all other classes.
|
@@ -300,15 +300,15 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
300
300
|
param1 => 'value1',
|
301
301
|
}
|
302
302
|
}
|
303
|
-
|
303
|
+
CODE
|
304
304
|
end
|
305
305
|
|
306
306
|
context 'with fix disabled' do
|
307
|
-
it '
|
307
|
+
it 'detects a single problem' do
|
308
308
|
expect(problems).to have(1).problem
|
309
309
|
end
|
310
310
|
|
311
|
-
it '
|
311
|
+
it 'creates a error' do
|
312
312
|
expect(problems).to contain_error(single_space_msg).on_line(6).in_column(7)
|
313
313
|
end
|
314
314
|
end
|
@@ -322,17 +322,17 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
322
322
|
PuppetLint.configuration.fix = false
|
323
323
|
end
|
324
324
|
|
325
|
-
it '
|
325
|
+
it 'detects a single problem' do
|
326
326
|
expect(problems).to have(1).problem
|
327
327
|
end
|
328
328
|
|
329
|
-
it '
|
329
|
+
it 'fixes the manifest' do
|
330
330
|
expect(problems).to contain_fixed(single_space_msg)
|
331
331
|
end
|
332
332
|
|
333
|
-
it '
|
333
|
+
it 'fixes the space' do
|
334
334
|
expect(manifest).to eq(
|
335
|
-
<<~
|
335
|
+
<<~CODE,
|
336
336
|
# example
|
337
337
|
#
|
338
338
|
# Main class, includes all other classes.
|
@@ -343,7 +343,7 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
343
343
|
param1 => 'value1',
|
344
344
|
}
|
345
345
|
}
|
346
|
-
|
346
|
+
CODE
|
347
347
|
)
|
348
348
|
end
|
349
349
|
end
|
@@ -351,7 +351,7 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
351
351
|
|
352
352
|
context 'with newline' do
|
353
353
|
let(:code) do
|
354
|
-
<<~
|
354
|
+
<<~CODE
|
355
355
|
# example
|
356
356
|
#
|
357
357
|
# Main class, includes all other classes.
|
@@ -365,15 +365,15 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
365
365
|
param1 => 'value1',
|
366
366
|
}
|
367
367
|
}
|
368
|
-
|
368
|
+
CODE
|
369
369
|
end
|
370
370
|
|
371
371
|
context 'with fix disabled' do
|
372
|
-
it '
|
372
|
+
it 'detects a single problem' do
|
373
373
|
expect(problems).to have(1).problem
|
374
374
|
end
|
375
375
|
|
376
|
-
it '
|
376
|
+
it 'creates a error' do
|
377
377
|
expect(problems).to contain_error(single_space_msg).on_line(6).in_column(7)
|
378
378
|
end
|
379
379
|
end
|
@@ -387,17 +387,17 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
387
387
|
PuppetLint.configuration.fix = false
|
388
388
|
end
|
389
389
|
|
390
|
-
it '
|
390
|
+
it 'detects a single problem' do
|
391
391
|
expect(problems).to have(1).problem
|
392
392
|
end
|
393
393
|
|
394
|
-
it '
|
394
|
+
it 'fixes the manifest' do
|
395
395
|
expect(problems).to contain_fixed(single_space_msg)
|
396
396
|
end
|
397
397
|
|
398
|
-
it '
|
398
|
+
it 'fixes the newline' do
|
399
399
|
expect(manifest).to eq(
|
400
|
-
<<~
|
400
|
+
<<~CODE,
|
401
401
|
# example
|
402
402
|
#
|
403
403
|
# Main class, includes all other classes.
|
@@ -408,7 +408,7 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
408
408
|
param1 => 'value1',
|
409
409
|
}
|
410
410
|
}
|
411
|
-
|
411
|
+
CODE
|
412
412
|
)
|
413
413
|
end
|
414
414
|
end
|
@@ -416,7 +416,7 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
416
416
|
|
417
417
|
context 'with comment' do
|
418
418
|
let(:code) do
|
419
|
-
<<~
|
419
|
+
<<~CODE
|
420
420
|
# example
|
421
421
|
#
|
422
422
|
# Main class, includes all other classes.
|
@@ -428,10 +428,10 @@ describe 'manifest_whitespace_class_name_single_space_after' do
|
|
428
428
|
param1 => 'value1',
|
429
429
|
}
|
430
430
|
}
|
431
|
-
|
431
|
+
CODE
|
432
432
|
end
|
433
433
|
|
434
|
-
it '
|
434
|
+
it 'detects no problem' do
|
435
435
|
expect(problems).to be_empty
|
436
436
|
end
|
437
437
|
end
|
@@ -7,7 +7,7 @@ describe 'manifest_whitespace_inherits_name_single_space_before' do
|
|
7
7
|
|
8
8
|
context 'with two spaces' do
|
9
9
|
let(:code) do
|
10
|
-
<<~
|
10
|
+
<<~CODE
|
11
11
|
# example
|
12
12
|
#
|
13
13
|
# Main class, includes all other classes.
|
@@ -18,15 +18,15 @@ describe 'manifest_whitespace_inherits_name_single_space_before' do
|
|
18
18
|
param1 => 'value1',
|
19
19
|
}
|
20
20
|
}
|
21
|
-
|
21
|
+
CODE
|
22
22
|
end
|
23
23
|
|
24
24
|
context 'with fix disabled' do
|
25
|
-
it '
|
25
|
+
it 'detects a single problem' do
|
26
26
|
expect(problems).to have(1).problem
|
27
27
|
end
|
28
28
|
|
29
|
-
it '
|
29
|
+
it 'creates a error' do
|
30
30
|
expect(problems).to contain_error(single_space_msg).on_line(6).in_column(23)
|
31
31
|
end
|
32
32
|
end
|
@@ -40,17 +40,17 @@ describe 'manifest_whitespace_inherits_name_single_space_before' do
|
|
40
40
|
PuppetLint.configuration.fix = false
|
41
41
|
end
|
42
42
|
|
43
|
-
it '
|
43
|
+
it 'detects a single problem' do
|
44
44
|
expect(problems).to have(1).problem
|
45
45
|
end
|
46
46
|
|
47
|
-
it '
|
47
|
+
it 'fixes the manifest' do
|
48
48
|
expect(problems).to contain_fixed(single_space_msg)
|
49
49
|
end
|
50
50
|
|
51
|
-
it '
|
51
|
+
it 'fixes the space' do
|
52
52
|
expect(manifest).to eq(
|
53
|
-
<<~
|
53
|
+
<<~CODE,
|
54
54
|
# example
|
55
55
|
#
|
56
56
|
# Main class, includes all other classes.
|
@@ -61,7 +61,7 @@ describe 'manifest_whitespace_inherits_name_single_space_before' do
|
|
61
61
|
param1 => 'value1',
|
62
62
|
}
|
63
63
|
}
|
64
|
-
|
64
|
+
CODE
|
65
65
|
)
|
66
66
|
end
|
67
67
|
end
|