puppet-lint 4.2.0 → 4.2.1
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/README.md +18 -4
- data/lib/puppet-lint/lexer.rb +2 -2
- data/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb +2 -2
- data/lib/puppet-lint/plugins/top_scope_facts/top_scope_facts.rb +4 -4
- data/lib/puppet-lint/version.rb +1 -1
- data/rubocop_baseline.yml +7 -0
- data/spec/spec_helper.rb +0 -1
- data/spec/unit/puppet-lint/checks_spec.rb +7 -2
- data/spec/unit/puppet-lint/ignore_overrides_spec.rb +6 -6
- data/spec/unit/puppet-lint/lexer_spec.rb +702 -699
- data/spec/unit/puppet-lint/plugins/check_classes/arrow_on_right_operand_line_spec.rb +5 -5
- data/spec/unit/puppet-lint/plugins/check_classes/autoloader_layout_spec.rb +8 -8
- data/spec/unit/puppet-lint/plugins/check_classes/class_inherits_from_params_class_spec.rb +2 -2
- data/spec/unit/puppet-lint/plugins/check_classes/code_on_top_scope_spec.rb +2 -1
- data/spec/unit/puppet-lint/plugins/check_classes/inherits_across_namespaces_spec.rb +3 -3
- data/spec/unit/puppet-lint/plugins/check_classes/name_contains_uppercase_spec.rb +3 -3
- data/spec/unit/puppet-lint/plugins/check_classes/names_containing_dash_spec.rb +3 -3
- data/spec/unit/puppet-lint/plugins/check_classes/nested_classes_or_defines_spec.rb +5 -5
- data/spec/unit/puppet-lint/plugins/check_classes/parameter_order_spec.rb +14 -14
- data/spec/unit/puppet-lint/plugins/check_classes/right_to_left_relationship_spec.rb +2 -2
- data/spec/unit/puppet-lint/plugins/check_classes/variable_scope_spec.rb +21 -21
- data/spec/unit/puppet-lint/plugins/check_comments/slash_comments_spec.rb +2 -2
- data/spec/unit/puppet-lint/plugins/check_comments/star_comments_spec.rb +4 -4
- data/spec/unit/puppet-lint/plugins/check_conditionals/case_without_default_spec.rb +6 -6
- data/spec/unit/puppet-lint/plugins/check_conditionals/selector_inside_resource_spec.rb +2 -2
- data/spec/unit/puppet-lint/plugins/check_documentation/documentation_spec.rb +5 -5
- data/spec/unit/puppet-lint/plugins/check_nodes/unquoted_node_name_spec.rb +11 -11
- data/spec/unit/puppet-lint/plugins/check_resources/duplicate_params_spec.rb +6 -6
- data/spec/unit/puppet-lint/plugins/check_resources/ensure_first_param_spec.rb +12 -12
- data/spec/unit/puppet-lint/plugins/check_resources/ensure_not_symlink_target_spec.rb +4 -4
- data/spec/unit/puppet-lint/plugins/check_resources/file_mode_spec.rb +22 -22
- data/spec/unit/puppet-lint/plugins/check_resources/unquoted_file_mode_spec.rb +8 -8
- data/spec/unit/puppet-lint/plugins/check_resources/unquoted_resource_title_spec.rb +13 -13
- data/spec/unit/puppet-lint/plugins/check_strings/double_quoted_strings_spec.rb +18 -18
- data/spec/unit/puppet-lint/plugins/check_strings/only_variable_string_spec.rb +6 -6
- data/spec/unit/puppet-lint/plugins/check_strings/puppet_url_without_modules_spec.rb +4 -4
- data/spec/unit/puppet-lint/plugins/check_strings/quoted_booleans_spec.rb +8 -8
- data/spec/unit/puppet-lint/plugins/check_strings/single_quote_string_with_variables_spec.rb +3 -3
- data/spec/unit/puppet-lint/plugins/check_strings/variables_not_enclosed_spec.rb +7 -7
- data/spec/unit/puppet-lint/plugins/check_variables/variable_contains_dash_spec.rb +2 -2
- data/spec/unit/puppet-lint/plugins/check_variables/variable_is_lowercase_spec.rb +5 -5
- data/spec/unit/puppet-lint/plugins/check_whitespace/140chars_spec.rb +4 -4
- data/spec/unit/puppet-lint/plugins/check_whitespace/2sp_soft_tabs_spec.rb +1 -1
- data/spec/unit/puppet-lint/plugins/check_whitespace/80chars_spec.rb +4 -4
- data/spec/unit/puppet-lint/plugins/check_whitespace/arrow_alignment_spec.rb +37 -37
- data/spec/unit/puppet-lint/plugins/check_whitespace/hard_tabs_spec.rb +2 -2
- data/spec/unit/puppet-lint/plugins/check_whitespace/trailing_whitespace_spec.rb +6 -6
- data/spec/unit/puppet-lint/plugins/legacy_facts/legacy_facts_spec.rb +83 -75
- data/spec/unit/puppet-lint/plugins/top_scope_facts/top_scope_facts_spec.rb +19 -19
- metadata +6 -4
@@ -6,7 +6,7 @@ describe 'legacy_facts' do
|
|
6
6
|
let(:code) { "$facts['os']['family']" }
|
7
7
|
|
8
8
|
it 'does not detect any problems' do
|
9
|
-
expect(problems).to
|
9
|
+
expect(problems).to be_empty
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -14,7 +14,7 @@ describe 'legacy_facts' do
|
|
14
14
|
let(:code) { "$facts['ssh']['rsa']['key']" }
|
15
15
|
|
16
16
|
it 'does not detect any problems' do
|
17
|
-
expect(problems).to
|
17
|
+
expect(problems).to be_empty
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -22,87 +22,87 @@ describe 'legacy_facts' do
|
|
22
22
|
let(:code) { '$osfamily' }
|
23
23
|
|
24
24
|
it 'does not detect any problems' do
|
25
|
-
expect(problems).to
|
25
|
+
expect(problems).to be_empty
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
context "fact variable using legacy $facts['osfamily']" do
|
30
30
|
let(:code) { "$facts['osfamily']" }
|
31
31
|
|
32
|
-
it '
|
33
|
-
expect(problems).to
|
32
|
+
it 'only detect a single problem' do
|
33
|
+
expect(problems.size).to eq(1)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
context 'fact variable using legacy $::osfamily' do
|
38
38
|
let(:code) { '$::osfamily' }
|
39
39
|
|
40
|
-
it '
|
41
|
-
expect(problems).to
|
40
|
+
it 'only detect a single problem' do
|
41
|
+
expect(problems.size).to eq(1)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
context 'fact variable using legacy $::blockdevice_sda_model' do
|
46
46
|
let(:code) { '$::blockdevice_sda_model' }
|
47
47
|
|
48
|
-
it '
|
49
|
-
expect(problems).to
|
48
|
+
it 'only detect a single problem' do
|
49
|
+
expect(problems.size).to eq(1)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
context "fact variable using legacy $facts['ipaddress6_em2']" do
|
54
54
|
let(:code) { "$facts['ipaddress6_em2']" }
|
55
55
|
|
56
|
-
it '
|
57
|
-
expect(problems).to
|
56
|
+
it 'only detect a single problem' do
|
57
|
+
expect(problems.size).to eq(1)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
context 'fact variable using legacy $::zone_foobar_uuid' do
|
62
62
|
let(:code) { '$::zone_foobar_uuid' }
|
63
63
|
|
64
|
-
it '
|
65
|
-
expect(problems).to
|
64
|
+
it 'only detect a single problem' do
|
65
|
+
expect(problems.size).to eq(1)
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
context 'fact variable using legacy $::processor314' do
|
70
70
|
let(:code) { '$::processor314' }
|
71
71
|
|
72
|
-
it '
|
73
|
-
expect(problems).to
|
72
|
+
it 'only detect a single problem' do
|
73
|
+
expect(problems.size).to eq(1)
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
77
|
context 'fact variable using legacy $::sp_l3_cache' do
|
78
78
|
let(:code) { '$::sp_l3_cache' }
|
79
79
|
|
80
|
-
it '
|
81
|
-
expect(problems).to
|
80
|
+
it 'only detect a single problem' do
|
81
|
+
expect(problems.size).to eq(1)
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
85
|
context 'fact variable using legacy $::sshrsakey' do
|
86
86
|
let(:code) { '$::sshrsakey' }
|
87
87
|
|
88
|
-
it '
|
89
|
-
expect(problems).to
|
88
|
+
it 'only detect a single problem' do
|
89
|
+
expect(problems.size).to eq(1)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
93
|
context 'fact variable in interpolated string "${::osfamily}"' do
|
94
94
|
let(:code) { '"start ${::osfamily} end"' }
|
95
95
|
|
96
|
-
it '
|
97
|
-
expect(problems).to
|
96
|
+
it 'only detect a single problem' do
|
97
|
+
expect(problems.size).to eq(1)
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
101
|
context 'fact variable using legacy variable in double quotes "$::osfamily"' do
|
102
102
|
let(:code) { '"$::osfamily"' }
|
103
103
|
|
104
|
-
it '
|
105
|
-
expect(problems).to
|
104
|
+
it 'only detect a single problem' do
|
105
|
+
expect(problems.size).to eq(1)
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
@@ -110,7 +110,7 @@ describe 'legacy_facts' do
|
|
110
110
|
let(:code) { %("${facts['osfamily']}") }
|
111
111
|
|
112
112
|
it 'detects a single problem' do
|
113
|
-
expect(problems).to
|
113
|
+
expect(problems.size).to eq(1)
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
@@ -118,7 +118,7 @@ describe 'legacy_facts' do
|
|
118
118
|
let(:code) { "$::facts['osfamily']" }
|
119
119
|
|
120
120
|
it 'detects a single problem' do
|
121
|
-
expect(problems).to
|
121
|
+
expect(problems.size).to eq(1)
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
@@ -126,7 +126,7 @@ describe 'legacy_facts' do
|
|
126
126
|
let(:code) { '$::facts[osfamily]' }
|
127
127
|
|
128
128
|
it 'detects a single problem' do
|
129
|
-
expect(problems).to
|
129
|
+
expect(problems.size).to eq(1)
|
130
130
|
end
|
131
131
|
end
|
132
132
|
end
|
@@ -144,7 +144,7 @@ describe 'legacy_facts' do
|
|
144
144
|
let(:code) { "$facts['os']['family']" }
|
145
145
|
|
146
146
|
it 'does not detect any problems' do
|
147
|
-
expect(problems).to
|
147
|
+
expect(problems).to be_empty
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
@@ -152,7 +152,7 @@ describe 'legacy_facts' do
|
|
152
152
|
let(:code) { "$facts['ssh']['rsa']['key']" }
|
153
153
|
|
154
154
|
it 'does not detect any problems' do
|
155
|
-
expect(problems).to
|
155
|
+
expect(problems).to be_empty
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
@@ -160,7 +160,7 @@ describe 'legacy_facts' do
|
|
160
160
|
let(:code) { '$osfamily' }
|
161
161
|
|
162
162
|
it 'does not detect any problems' do
|
163
|
-
expect(problems).to
|
163
|
+
expect(problems).to be_empty
|
164
164
|
end
|
165
165
|
end
|
166
166
|
|
@@ -168,8 +168,8 @@ describe 'legacy_facts' do
|
|
168
168
|
let(:code) { "$facts['osfamily']" }
|
169
169
|
let(:msg) { "legacy fact 'osfamily'" }
|
170
170
|
|
171
|
-
it '
|
172
|
-
expect(problems).to
|
171
|
+
it 'only detect a single problem' do
|
172
|
+
expect(problems.size).to eq(1)
|
173
173
|
end
|
174
174
|
|
175
175
|
it 'fixes the problem' do
|
@@ -185,7 +185,7 @@ describe 'legacy_facts' do
|
|
185
185
|
let(:code) { "$::facts['os']['family']" }
|
186
186
|
|
187
187
|
it 'does not detect any problems' do
|
188
|
-
expect(problems).to
|
188
|
+
expect(problems).to be_empty
|
189
189
|
end
|
190
190
|
end
|
191
191
|
|
@@ -194,7 +194,7 @@ describe 'legacy_facts' do
|
|
194
194
|
let(:msg) { "legacy fact 'osfamily'" }
|
195
195
|
|
196
196
|
it 'only detects a single problem' do
|
197
|
-
expect(problems).to
|
197
|
+
expect(problems.size).to eq(1)
|
198
198
|
end
|
199
199
|
|
200
200
|
it 'fixes the problem' do
|
@@ -210,8 +210,8 @@ describe 'legacy_facts' do
|
|
210
210
|
let(:code) { '$::osfamily' }
|
211
211
|
let(:msg) { "legacy fact 'osfamily'" }
|
212
212
|
|
213
|
-
it '
|
214
|
-
expect(problems).to
|
213
|
+
it 'only detect a single problem' do
|
214
|
+
expect(problems.size).to eq(1)
|
215
215
|
end
|
216
216
|
|
217
217
|
it 'fixes the problem' do
|
@@ -227,8 +227,8 @@ describe 'legacy_facts' do
|
|
227
227
|
let(:code) { '$::sshrsakey' }
|
228
228
|
let(:msg) { "legacy fact 'sshrsakey'" }
|
229
229
|
|
230
|
-
it '
|
231
|
-
expect(problems).to
|
230
|
+
it 'only detect a single problem' do
|
231
|
+
expect(problems.size).to eq(1)
|
232
232
|
end
|
233
233
|
|
234
234
|
it 'fixes the problem' do
|
@@ -243,8 +243,8 @@ describe 'legacy_facts' do
|
|
243
243
|
context 'fact variable using legacy $::memoryfree_mb' do
|
244
244
|
let(:code) { '$::memoryfree_mb' }
|
245
245
|
|
246
|
-
it '
|
247
|
-
expect(problems).to
|
246
|
+
it 'only detect a single problem' do
|
247
|
+
expect(problems.size).to eq(1)
|
248
248
|
end
|
249
249
|
|
250
250
|
it 'continues to use the legacy fact' do
|
@@ -255,8 +255,8 @@ describe 'legacy_facts' do
|
|
255
255
|
context 'fact variable using legacy $::blockdevice_sda_model' do
|
256
256
|
let(:code) { '$::blockdevice_sda_model' }
|
257
257
|
|
258
|
-
it '
|
259
|
-
expect(problems).to
|
258
|
+
it 'only detect a single problem' do
|
259
|
+
expect(problems.size).to eq(1)
|
260
260
|
end
|
261
261
|
|
262
262
|
it 'uses the facts hash' do
|
@@ -267,8 +267,8 @@ describe 'legacy_facts' do
|
|
267
267
|
context "fact variable using legacy $facts['ipaddress6_em2']" do
|
268
268
|
let(:code) { "$facts['ipaddress6_em2']" }
|
269
269
|
|
270
|
-
it '
|
271
|
-
expect(problems).to
|
270
|
+
it 'only detect a single problem' do
|
271
|
+
expect(problems.size).to eq(1)
|
272
272
|
end
|
273
273
|
|
274
274
|
it 'uses the facts hash' do
|
@@ -279,8 +279,8 @@ describe 'legacy_facts' do
|
|
279
279
|
context 'fact variable using legacy $::zone_foobar_uuid' do
|
280
280
|
let(:code) { '$::zone_foobar_uuid' }
|
281
281
|
|
282
|
-
it '
|
283
|
-
expect(problems).to
|
282
|
+
it 'only detect a single problem' do
|
283
|
+
expect(problems.size).to eq(1)
|
284
284
|
end
|
285
285
|
|
286
286
|
it 'uses the facts hash' do
|
@@ -291,8 +291,8 @@ describe 'legacy_facts' do
|
|
291
291
|
context 'fact variable using legacy $::processor314' do
|
292
292
|
let(:code) { '$::processor314' }
|
293
293
|
|
294
|
-
it '
|
295
|
-
expect(problems).to
|
294
|
+
it 'only detect a single problem' do
|
295
|
+
expect(problems.size).to eq(1)
|
296
296
|
end
|
297
297
|
|
298
298
|
it 'uses the facts hash' do
|
@@ -303,8 +303,8 @@ describe 'legacy_facts' do
|
|
303
303
|
context 'fact variable using legacy $::sp_l3_cache' do
|
304
304
|
let(:code) { '$::sp_l3_cache' }
|
305
305
|
|
306
|
-
it '
|
307
|
-
expect(problems).to
|
306
|
+
it 'only detect a single problem' do
|
307
|
+
expect(problems.size).to eq(1)
|
308
308
|
end
|
309
309
|
|
310
310
|
it 'uses the facts hash' do
|
@@ -315,8 +315,8 @@ describe 'legacy_facts' do
|
|
315
315
|
context 'fact variable using legacy $::sshrsakey' do
|
316
316
|
let(:code) { '$::sshrsakey' }
|
317
317
|
|
318
|
-
it '
|
319
|
-
expect(problems).to
|
318
|
+
it 'only detect a single problem' do
|
319
|
+
expect(problems.size).to eq(1)
|
320
320
|
end
|
321
321
|
|
322
322
|
it 'uses the facts hash' do
|
@@ -327,8 +327,8 @@ describe 'legacy_facts' do
|
|
327
327
|
context 'fact variable in interpolated string "${::osfamily}"' do
|
328
328
|
let(:code) { '"start ${::osfamily} end"' }
|
329
329
|
|
330
|
-
it '
|
331
|
-
expect(problems).to
|
330
|
+
it 'only detect a single problem' do
|
331
|
+
expect(problems.size).to eq(1)
|
332
332
|
end
|
333
333
|
|
334
334
|
it 'uses the facts hash' do
|
@@ -339,8 +339,8 @@ describe 'legacy_facts' do
|
|
339
339
|
context 'fact variable using legacy variable in double quotes "$::osfamily"' do
|
340
340
|
let(:code) { '"$::osfamily"' }
|
341
341
|
|
342
|
-
it '
|
343
|
-
expect(problems).to
|
342
|
+
it 'only detect a single problem' do
|
343
|
+
expect(problems.size).to eq(1)
|
344
344
|
end
|
345
345
|
|
346
346
|
it 'uses the facts hash' do
|
@@ -351,8 +351,8 @@ describe 'legacy_facts' do
|
|
351
351
|
context 'fact variable using legacy variable in double quotes "$::gid"' do
|
352
352
|
let(:code) { '"$::gid"' }
|
353
353
|
|
354
|
-
it '
|
355
|
-
expect(problems).to
|
354
|
+
it 'only detect a single problem' do
|
355
|
+
expect(problems.size).to eq(1)
|
356
356
|
end
|
357
357
|
|
358
358
|
it 'uses the facts hash' do
|
@@ -363,8 +363,8 @@ describe 'legacy_facts' do
|
|
363
363
|
context 'fact variable using legacy variable in double quotes "$::id"' do
|
364
364
|
let(:code) { '"$::id"' }
|
365
365
|
|
366
|
-
it '
|
367
|
-
expect(problems).to
|
366
|
+
it 'only detect a single problem' do
|
367
|
+
expect(problems.size).to eq(1)
|
368
368
|
end
|
369
369
|
|
370
370
|
it 'uses the facts hash' do
|
@@ -375,8 +375,8 @@ describe 'legacy_facts' do
|
|
375
375
|
context 'fact variable using legacy variable in double quotes "$::lsbdistcodename"' do
|
376
376
|
let(:code) { '"$::lsbdistcodename"' }
|
377
377
|
|
378
|
-
it '
|
379
|
-
expect(problems).to
|
378
|
+
it 'only detect a single problem' do
|
379
|
+
expect(problems.size).to eq(1)
|
380
380
|
end
|
381
381
|
|
382
382
|
it 'uses the facts hash' do
|
@@ -387,8 +387,8 @@ describe 'legacy_facts' do
|
|
387
387
|
context 'fact variable using legacy variable in double quotes "$::lsbdistdescription"' do
|
388
388
|
let(:code) { '"$::lsbdistdescription"' }
|
389
389
|
|
390
|
-
it '
|
391
|
-
expect(problems).to
|
390
|
+
it 'only detect a single problem' do
|
391
|
+
expect(problems.size).to eq(1)
|
392
392
|
end
|
393
393
|
|
394
394
|
it 'uses the facts hash' do
|
@@ -399,8 +399,8 @@ describe 'legacy_facts' do
|
|
399
399
|
context 'fact variable using legacy variable in double quotes "$::lsbdistid"' do
|
400
400
|
let(:code) { '"$::lsbdistid"' }
|
401
401
|
|
402
|
-
it '
|
403
|
-
expect(problems).to
|
402
|
+
it 'only detect a single problem' do
|
403
|
+
expect(problems.size).to eq(1)
|
404
404
|
end
|
405
405
|
|
406
406
|
it 'uses the facts hash' do
|
@@ -411,8 +411,8 @@ describe 'legacy_facts' do
|
|
411
411
|
context 'fact variable using legacy variable in double quotes "$::lsbdistrelease"' do
|
412
412
|
let(:code) { '"$::lsbdistrelease"' }
|
413
413
|
|
414
|
-
it '
|
415
|
-
expect(problems).to
|
414
|
+
it 'only detect a single problem' do
|
415
|
+
expect(problems.size).to eq(1)
|
416
416
|
end
|
417
417
|
|
418
418
|
it 'uses the facts hash' do
|
@@ -423,8 +423,8 @@ describe 'legacy_facts' do
|
|
423
423
|
context 'fact variable using legacy variable in double quotes "$::lsbmajdistrelease"' do
|
424
424
|
let(:code) { '"$::lsbmajdistrelease"' }
|
425
425
|
|
426
|
-
it '
|
427
|
-
expect(problems).to
|
426
|
+
it 'only detect a single problem' do
|
427
|
+
expect(problems.size).to eq(1)
|
428
428
|
end
|
429
429
|
|
430
430
|
it 'uses the facts hash' do
|
@@ -435,8 +435,8 @@ describe 'legacy_facts' do
|
|
435
435
|
context 'fact variable using legacy variable in double quotes "$::lsbminordistrelease"' do
|
436
436
|
let(:code) { '"$::lsbminordistrelease"' }
|
437
437
|
|
438
|
-
it '
|
439
|
-
expect(problems).to
|
438
|
+
it 'only detect a single problem' do
|
439
|
+
expect(problems.size).to eq(1)
|
440
440
|
end
|
441
441
|
|
442
442
|
it 'uses the facts hash' do
|
@@ -447,8 +447,8 @@ describe 'legacy_facts' do
|
|
447
447
|
context 'fact variable using legacy variable in double quotes "$::lsbrelease"' do
|
448
448
|
let(:code) { '"$::lsbrelease"' }
|
449
449
|
|
450
|
-
it '
|
451
|
-
expect(problems).to
|
450
|
+
it 'only detect a single problem' do
|
451
|
+
expect(problems.size).to eq(1)
|
452
452
|
end
|
453
453
|
|
454
454
|
it 'uses the facts hash' do
|
@@ -459,13 +459,21 @@ describe 'legacy_facts' do
|
|
459
459
|
context "fact variable using facts hash in double quotes \"$facts['lsbrelease']\"" do
|
460
460
|
let(:code) { "\"${facts['lsbrelease']}\"" }
|
461
461
|
|
462
|
-
it '
|
463
|
-
expect(problems).to
|
462
|
+
it 'only detect a single problem' do
|
463
|
+
expect(problems.size).to eq(1)
|
464
464
|
end
|
465
465
|
|
466
466
|
it 'uses the facts hash' do
|
467
467
|
expect(manifest).to eq("\"${facts['os']['distro']['release']['specification']}\"")
|
468
468
|
end
|
469
469
|
end
|
470
|
+
|
471
|
+
context 'variable ending in the word fact' do
|
472
|
+
let(:code) { "$interface_facts['netmask']" }
|
473
|
+
|
474
|
+
it 'does not detect any problems' do
|
475
|
+
expect(problems.size).to eq(0)
|
476
|
+
end
|
477
|
+
end
|
470
478
|
end
|
471
479
|
end
|
@@ -8,7 +8,7 @@ describe 'top_scope_facts' do
|
|
8
8
|
let(:code) { "$facts['operatingsystem']" }
|
9
9
|
|
10
10
|
it 'does not detect any problems' do
|
11
|
-
expect(problems).to
|
11
|
+
expect(problems).to be_empty
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -16,7 +16,7 @@ describe 'top_scope_facts' do
|
|
16
16
|
let(:code) { '$foo::bar' }
|
17
17
|
|
18
18
|
it 'does not detect any problems' do
|
19
|
-
expect(problems).to
|
19
|
+
expect(problems).to be_empty
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -24,7 +24,7 @@ describe 'top_scope_facts' do
|
|
24
24
|
let(:code) { "$::facts['os']['family']" }
|
25
25
|
|
26
26
|
it 'does not detect any problems' do
|
27
|
-
expect(problems).to
|
27
|
+
expect(problems).to be_empty
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -32,7 +32,7 @@ describe 'top_scope_facts' do
|
|
32
32
|
let(:code) { "$::trusted['certname']" }
|
33
33
|
|
34
34
|
it 'does not detect any problems' do
|
35
|
-
expect(problems).to
|
35
|
+
expect(problems).to be_empty
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -40,7 +40,7 @@ describe 'top_scope_facts' do
|
|
40
40
|
let(:code) { '$::fqdn' }
|
41
41
|
|
42
42
|
it 'does not detect a single problem' do
|
43
|
-
expect(problems).to
|
43
|
+
expect(problems).to be_empty
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -48,14 +48,14 @@ describe 'top_scope_facts' do
|
|
48
48
|
let(:code) { '$::profile::foo::bar' }
|
49
49
|
|
50
50
|
it 'does not detect any problems' do
|
51
|
-
expect(problems).to
|
51
|
+
expect(problems).to be_empty
|
52
52
|
end
|
53
53
|
|
54
54
|
context 'inside double quotes' do
|
55
55
|
let(:code) { '"$::profile::foo::bar"' }
|
56
56
|
|
57
57
|
it 'does not detect any problems' do
|
58
|
-
expect(problems).to
|
58
|
+
expect(problems).to be_empty
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -63,7 +63,7 @@ describe 'top_scope_facts' do
|
|
63
63
|
let(:code) { '"${::profile::foo::bar}"' }
|
64
64
|
|
65
65
|
it 'does not detect any problems' do
|
66
|
-
expect(problems).to
|
66
|
+
expect(problems).to be_empty
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
@@ -82,7 +82,7 @@ describe 'top_scope_facts' do
|
|
82
82
|
let(:code) { "$facts['operatingsystem']" }
|
83
83
|
|
84
84
|
it 'does not detect any problems' do
|
85
|
-
expect(problems).to
|
85
|
+
expect(problems).to be_empty
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -90,7 +90,7 @@ describe 'top_scope_facts' do
|
|
90
90
|
let(:code) { '$foo::bar' }
|
91
91
|
|
92
92
|
it 'does not detect any problems' do
|
93
|
-
expect(problems).to
|
93
|
+
expect(problems).to be_empty
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
@@ -98,7 +98,7 @@ describe 'top_scope_facts' do
|
|
98
98
|
let(:code) { "$::facts['os']['family']" }
|
99
99
|
|
100
100
|
it 'does not detect any problems' do
|
101
|
-
expect(problems).to
|
101
|
+
expect(problems).to be_empty
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
@@ -106,7 +106,7 @@ describe 'top_scope_facts' do
|
|
106
106
|
let(:code) { "$::trusted['certname']" }
|
107
107
|
|
108
108
|
it 'does not detect any problems' do
|
109
|
-
expect(problems).to
|
109
|
+
expect(problems).to be_empty
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
@@ -119,7 +119,7 @@ describe 'top_scope_facts' do
|
|
119
119
|
let(:code) { "$facts['operatingsystem']" }
|
120
120
|
|
121
121
|
it 'does not detect any problems' do
|
122
|
-
expect(problems).to
|
122
|
+
expect(problems).to be_empty
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
@@ -127,23 +127,23 @@ describe 'top_scope_facts' do
|
|
127
127
|
let(:code) { "$trusted['certname']" }
|
128
128
|
|
129
129
|
it 'does not detect any problems' do
|
130
|
-
expect(problems).to
|
130
|
+
expect(problems).to be_empty
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
|
-
context '
|
134
|
+
context 'allowlisted top scope variable $::location' do
|
135
135
|
let(:code) { '$::location' }
|
136
136
|
|
137
137
|
it 'does not detect any problems' do
|
138
|
-
expect(problems).to
|
138
|
+
expect(problems).to be_empty
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
-
context 'non-
|
142
|
+
context 'non-allowlisted top scope variable $::application' do
|
143
143
|
let(:code) { '$::application' }
|
144
144
|
|
145
|
-
it '
|
146
|
-
expect(problems).to
|
145
|
+
it 'detects a problem' do
|
146
|
+
expect(problems).to contain_fixed('top scope fact instead of facts hash').on_line(1).in_column(1)
|
147
147
|
end
|
148
148
|
end
|
149
149
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Sharpe
|
@@ -10,10 +10,12 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-
|
13
|
+
date: 2023-10-09 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
|
-
description:
|
16
|
-
|
15
|
+
description: |2
|
16
|
+
Checks your Puppet manifests against the Puppetlabs style guide and alerts you to any discrepancies.
|
17
|
+
Note: Support for this gem has been moved under a new namespace and as such any future updates from
|
18
|
+
the Puppet team will be released as `puppetlabs-puppet-lint`.
|
17
19
|
email:
|
18
20
|
- tim@sharpe.id.au
|
19
21
|
- modules-team@puppet.com
|