puppet-lint 2.5.2 → 3.0.1
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 +60 -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 +27 -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 +63 -119
- data/CHANGELOG.md +0 -33
- data/HISTORY.md +0 -1130
- data/spec/puppet-lint/configuration_spec.rb +0 -66
- data/spec/puppet-lint_spec.rb +0 -16
@@ -12,11 +12,11 @@ describe 'variable_scope' do
|
|
12
12
|
END
|
13
13
|
end
|
14
14
|
|
15
|
-
it '
|
15
|
+
it 'only detects a single problem' do
|
16
16
|
expect(problems).to have(1).problem
|
17
17
|
end
|
18
18
|
|
19
|
-
it '
|
19
|
+
it 'creates a warning' do
|
20
20
|
expect(problems).to contain_warning(msg).on_line(2).in_column(18)
|
21
21
|
end
|
22
22
|
end
|
@@ -30,7 +30,7 @@ describe 'variable_scope' do
|
|
30
30
|
END
|
31
31
|
end
|
32
32
|
|
33
|
-
it '
|
33
|
+
it 'does not detect any problems' do
|
34
34
|
expect(problems).to have(0).problems
|
35
35
|
end
|
36
36
|
end
|
@@ -45,7 +45,7 @@ describe 'variable_scope' do
|
|
45
45
|
END
|
46
46
|
end
|
47
47
|
|
48
|
-
it '
|
48
|
+
it 'does not detect any problems' do
|
49
49
|
expect(problems).to have(0).problems
|
50
50
|
end
|
51
51
|
end
|
@@ -64,7 +64,7 @@ describe 'variable_scope' do
|
|
64
64
|
END
|
65
65
|
end
|
66
66
|
|
67
|
-
it '
|
67
|
+
it 'does not detect any problems' do
|
68
68
|
expect(problems).to have(0).problems
|
69
69
|
end
|
70
70
|
end
|
@@ -79,7 +79,7 @@ describe 'variable_scope' do
|
|
79
79
|
END
|
80
80
|
end
|
81
81
|
|
82
|
-
it '
|
82
|
+
it 'does not detect any problems' do
|
83
83
|
expect(problems).to have(0).problems
|
84
84
|
end
|
85
85
|
end
|
@@ -93,7 +93,7 @@ describe 'variable_scope' do
|
|
93
93
|
END
|
94
94
|
end
|
95
95
|
|
96
|
-
it '
|
96
|
+
it 'does not detect any problems' do
|
97
97
|
expect(problems).to have(0).problems
|
98
98
|
end
|
99
99
|
end
|
@@ -107,11 +107,11 @@ describe 'variable_scope' do
|
|
107
107
|
END
|
108
108
|
end
|
109
109
|
|
110
|
-
it '
|
110
|
+
it 'only detects a single problem' do
|
111
111
|
expect(problems).to have(1).problem
|
112
112
|
end
|
113
113
|
|
114
|
-
it '
|
114
|
+
it 'creates a warning' do
|
115
115
|
expect(problems).to contain_warning(msg).on_line(2).in_column(18)
|
116
116
|
end
|
117
117
|
end
|
@@ -125,7 +125,7 @@ describe 'variable_scope' do
|
|
125
125
|
END
|
126
126
|
end
|
127
127
|
|
128
|
-
it '
|
128
|
+
it 'does not detect any problems' do
|
129
129
|
expect(problems).to have(0).problems
|
130
130
|
end
|
131
131
|
end
|
@@ -142,7 +142,7 @@ describe 'variable_scope' do
|
|
142
142
|
END
|
143
143
|
end
|
144
144
|
|
145
|
-
it '
|
145
|
+
it 'does not detect any problems' do
|
146
146
|
expect(problems).to have(0).problems
|
147
147
|
end
|
148
148
|
end
|
@@ -158,7 +158,7 @@ describe 'variable_scope' do
|
|
158
158
|
END
|
159
159
|
end
|
160
160
|
|
161
|
-
it '
|
161
|
+
it 'does not detect any problems' do
|
162
162
|
expect(problems).to have(0).problems
|
163
163
|
end
|
164
164
|
end
|
@@ -180,11 +180,11 @@ describe 'variable_scope' do
|
|
180
180
|
END
|
181
181
|
end
|
182
182
|
|
183
|
-
it '
|
183
|
+
it 'only detects two problems' do
|
184
184
|
expect(problems).to have(2).problem
|
185
185
|
end
|
186
186
|
|
187
|
-
it '
|
187
|
+
it 'creates two warnings' do
|
188
188
|
expect(problems).to contain_warning(msg).on_line(7).in_column(11)
|
189
189
|
expect(problems).to contain_warning(msg).on_line(5).in_column(13)
|
190
190
|
end
|
@@ -212,18 +212,18 @@ describe 'variable_scope' do
|
|
212
212
|
END
|
213
213
|
end
|
214
214
|
|
215
|
-
it '
|
215
|
+
it 'only detects three problems' do
|
216
216
|
expect(problems).to have(3).problem
|
217
217
|
end
|
218
218
|
|
219
|
-
it '
|
219
|
+
it 'creates three warnings' do
|
220
220
|
expect(problems).to contain_warning(msg).on_line(7).in_column(13)
|
221
221
|
expect(problems).to contain_warning(msg).on_line(12).in_column(15)
|
222
222
|
expect(problems).to contain_warning(msg).on_line(14).in_column(13)
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
226
|
-
|
226
|
+
['alias', 'audit', 'before', 'loglevel', 'noop', 'notify', 'require', 'schedule', 'stage', 'subscribe', 'tag'].each do |metaparam|
|
227
227
|
context "referencing #{metaparam} metaparam value as a variable" do
|
228
228
|
let(:code) do
|
229
229
|
<<-END
|
@@ -233,7 +233,7 @@ describe 'variable_scope' do
|
|
233
233
|
END
|
234
234
|
end
|
235
235
|
|
236
|
-
it '
|
236
|
+
it 'does not detect any problems' do
|
237
237
|
expect(problems).to have(0).problems
|
238
238
|
end
|
239
239
|
end
|
@@ -250,7 +250,7 @@ describe 'variable_scope' do
|
|
250
250
|
END
|
251
251
|
end
|
252
252
|
|
253
|
-
it '
|
253
|
+
it 'does not detect any problems' do
|
254
254
|
expect(problems).to have(0).problems
|
255
255
|
end
|
256
256
|
end
|
@@ -264,7 +264,7 @@ describe 'variable_scope' do
|
|
264
264
|
END
|
265
265
|
end
|
266
266
|
|
267
|
-
it '
|
267
|
+
it 'does not detect any problems' do
|
268
268
|
expect(problems).to have(0).problems
|
269
269
|
end
|
270
270
|
end
|
@@ -278,7 +278,7 @@ describe 'variable_scope' do
|
|
278
278
|
END
|
279
279
|
end
|
280
280
|
|
281
|
-
it '
|
281
|
+
it 'does not detect any problems' do
|
282
282
|
expect(problems).to have(0).problems
|
283
283
|
end
|
284
284
|
end
|
@@ -293,7 +293,7 @@ describe 'variable_scope' do
|
|
293
293
|
END
|
294
294
|
end
|
295
295
|
|
296
|
-
it '
|
296
|
+
it 'does not detect any problems' do
|
297
297
|
expect(problems).to have(0).problems
|
298
298
|
end
|
299
299
|
end
|
@@ -308,11 +308,11 @@ describe 'variable_scope' do
|
|
308
308
|
END
|
309
309
|
end
|
310
310
|
|
311
|
-
it '
|
311
|
+
it 'only detects one problem' do
|
312
312
|
expect(problems).to have(1).problems
|
313
313
|
end
|
314
314
|
|
315
|
-
it '
|
315
|
+
it 'creates one warning' do
|
316
316
|
expect(problems).to contain_warning(msg).on_line(2).in_column(14)
|
317
317
|
end
|
318
318
|
end
|
@@ -326,7 +326,7 @@ describe 'variable_scope' do
|
|
326
326
|
END
|
327
327
|
end
|
328
328
|
|
329
|
-
it '
|
329
|
+
it 'does not detect any problems' do
|
330
330
|
expect(problems).to have(0).problems
|
331
331
|
end
|
332
332
|
end
|
@@ -7,37 +7,37 @@ describe 'slash_comments' do
|
|
7
7
|
context 'slash comments' do
|
8
8
|
let(:code) { '// foo' }
|
9
9
|
|
10
|
-
it '
|
10
|
+
it 'only detects a single problem' do
|
11
11
|
expect(problems).to have(1).problem
|
12
12
|
end
|
13
13
|
|
14
|
-
it '
|
14
|
+
it 'creates a warning' do
|
15
15
|
expect(problems).to contain_warning(msg).on_line(1).in_column(1)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
context 'with fix enabled' do
|
21
|
-
before do
|
21
|
+
before(:each) do
|
22
22
|
PuppetLint.configuration.fix = true
|
23
23
|
end
|
24
24
|
|
25
|
-
after do
|
25
|
+
after(:each) do
|
26
26
|
PuppetLint.configuration.fix = false
|
27
27
|
end
|
28
28
|
|
29
29
|
context 'slash comments' do
|
30
30
|
let(:code) { '// foo' }
|
31
31
|
|
32
|
-
it '
|
32
|
+
it 'only detects a single problem' do
|
33
33
|
expect(problems).to have(1).problem
|
34
34
|
end
|
35
35
|
|
36
|
-
it '
|
36
|
+
it 'fixes the manifest' do
|
37
37
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(1)
|
38
38
|
end
|
39
39
|
|
40
|
-
it '
|
40
|
+
it 'replaces the double slash with a hash' do
|
41
41
|
expect(manifest).to eq('# foo')
|
42
42
|
end
|
43
43
|
end
|
@@ -12,22 +12,22 @@ describe 'star_comments' do
|
|
12
12
|
END
|
13
13
|
end
|
14
14
|
|
15
|
-
it '
|
15
|
+
it 'only detects a single problem' do
|
16
16
|
expect(problems).to have(1).problem
|
17
17
|
end
|
18
18
|
|
19
|
-
it '
|
19
|
+
it 'creates a warning' do
|
20
20
|
expect(problems).to contain_warning(msg).on_line(1).in_column(11)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
context 'with fix enabled' do
|
26
|
-
before do
|
26
|
+
before(:each) do
|
27
27
|
PuppetLint.configuration.fix = true
|
28
28
|
end
|
29
29
|
|
30
|
-
after do
|
30
|
+
after(:each) do
|
31
31
|
PuppetLint.configuration.fix = false
|
32
32
|
end
|
33
33
|
|
@@ -48,15 +48,15 @@ describe 'star_comments' do
|
|
48
48
|
END
|
49
49
|
end
|
50
50
|
|
51
|
-
it '
|
51
|
+
it 'only detects a single problem' do
|
52
52
|
expect(problems).to have(1).problem
|
53
53
|
end
|
54
54
|
|
55
|
-
it '
|
55
|
+
it 'creates a warning' do
|
56
56
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(1)
|
57
57
|
end
|
58
58
|
|
59
|
-
it '
|
59
|
+
it 'converts the multiline comment' do
|
60
60
|
expect(manifest).to eq(fixed)
|
61
61
|
end
|
62
62
|
end
|
@@ -75,15 +75,15 @@ describe 'star_comments' do
|
|
75
75
|
END
|
76
76
|
end
|
77
77
|
|
78
|
-
it '
|
78
|
+
it 'only detects a single problem' do
|
79
79
|
expect(problems).to have(1).problem
|
80
80
|
end
|
81
81
|
|
82
|
-
it '
|
82
|
+
it 'creates a warning' do
|
83
83
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(11)
|
84
84
|
end
|
85
85
|
|
86
|
-
it '
|
86
|
+
it 'converts the multiline comment' do
|
87
87
|
expect(manifest).to eq(fixed)
|
88
88
|
end
|
89
89
|
end
|
@@ -108,15 +108,15 @@ describe 'star_comments' do
|
|
108
108
|
END
|
109
109
|
end
|
110
110
|
|
111
|
-
it '
|
111
|
+
it 'only detects a single problem' do
|
112
112
|
expect(problems).to have(1).problem
|
113
113
|
end
|
114
114
|
|
115
|
-
it '
|
115
|
+
it 'creates a warning' do
|
116
116
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(11)
|
117
117
|
end
|
118
118
|
|
119
|
-
it '
|
119
|
+
it 'converts the multiline comment' do
|
120
120
|
expect(manifest).to eq(fixed)
|
121
121
|
end
|
122
122
|
end
|
data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_conditionals/case_without_default_spec.rb
RENAMED
@@ -13,7 +13,7 @@ describe 'case_without_default' do
|
|
13
13
|
END
|
14
14
|
end
|
15
15
|
|
16
|
-
it '
|
16
|
+
it 'does not detect any problems' do
|
17
17
|
expect(problems).to have(0).problems
|
18
18
|
end
|
19
19
|
end
|
@@ -28,11 +28,11 @@ describe 'case_without_default' do
|
|
28
28
|
END
|
29
29
|
end
|
30
30
|
|
31
|
-
it '
|
31
|
+
it 'only detects a single problem' do
|
32
32
|
expect(problems).to have(1).problem
|
33
33
|
end
|
34
34
|
|
35
|
-
it '
|
35
|
+
it 'creates a warning' do
|
36
36
|
expect(problems).to contain_warning(msg).on_line(1).in_column(9)
|
37
37
|
end
|
38
38
|
end
|
@@ -49,11 +49,11 @@ describe 'case_without_default' do
|
|
49
49
|
END
|
50
50
|
end
|
51
51
|
|
52
|
-
it '
|
52
|
+
it 'only detects a single problem' do
|
53
53
|
expect(problems).to have(1).problem
|
54
54
|
end
|
55
55
|
|
56
|
-
it '
|
56
|
+
it 'creates a warning' do
|
57
57
|
expect(problems).to contain_warning(msg)
|
58
58
|
end
|
59
59
|
end
|
@@ -73,11 +73,11 @@ describe 'case_without_default' do
|
|
73
73
|
END
|
74
74
|
end
|
75
75
|
|
76
|
-
it '
|
76
|
+
it 'detects two problems' do
|
77
77
|
expect(problems).to have(2).problems
|
78
78
|
end
|
79
79
|
|
80
|
-
it '
|
80
|
+
it 'creates two warnings' do
|
81
81
|
expect(problems).to contain_warning(msg).on_line(1).in_column(9)
|
82
82
|
expect(problems).to contain_warning(msg).on_line(4).in_column(13)
|
83
83
|
end
|
@@ -101,7 +101,7 @@ describe 'case_without_default' do
|
|
101
101
|
END
|
102
102
|
end
|
103
103
|
|
104
|
-
it '
|
104
|
+
it 'does not detect any problems' do
|
105
105
|
expect(problems).to have(0).problems
|
106
106
|
end
|
107
107
|
end
|
@@ -120,7 +120,7 @@ describe 'case_without_default' do
|
|
120
120
|
END
|
121
121
|
end
|
122
122
|
|
123
|
-
it '
|
123
|
+
it 'creates one warning' do
|
124
124
|
expect(problems).to contain_warning(msg).on_line(1).in_column(9)
|
125
125
|
end
|
126
126
|
end
|
@@ -140,7 +140,7 @@ describe 'case_without_default' do
|
|
140
140
|
END
|
141
141
|
end
|
142
142
|
|
143
|
-
it '
|
143
|
+
it 'does not detect any problems' do
|
144
144
|
expect(problems).to have(0).problems
|
145
145
|
end
|
146
146
|
end
|
@@ -15,11 +15,11 @@ describe 'selector_inside_resource' do
|
|
15
15
|
END
|
16
16
|
end
|
17
17
|
|
18
|
-
it '
|
18
|
+
it 'only detects a single problem' do
|
19
19
|
expect(problems).to have(1).problem
|
20
20
|
end
|
21
21
|
|
22
|
-
it '
|
22
|
+
it 'creates a warning' do
|
23
23
|
expect(problems).to contain_warning(msg).on_line(2).in_column(18)
|
24
24
|
end
|
25
25
|
end
|
@@ -33,7 +33,7 @@ describe 'selector_inside_resource' do
|
|
33
33
|
END
|
34
34
|
end
|
35
35
|
|
36
|
-
it '
|
36
|
+
it 'does not detect any problems' do
|
37
37
|
expect(problems).to have(0).problems
|
38
38
|
end
|
39
39
|
end
|
data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_documentation/documentation_spec.rb
RENAMED
@@ -7,11 +7,11 @@ describe 'documentation' do
|
|
7
7
|
describe 'undocumented class' do
|
8
8
|
let(:code) { 'class test {}' }
|
9
9
|
|
10
|
-
it '
|
10
|
+
it 'only detects a single problem' do
|
11
11
|
expect(problems).to have(1).problem
|
12
12
|
end
|
13
13
|
|
14
|
-
it '
|
14
|
+
it 'creates a warning' do
|
15
15
|
expect(problems).to contain_warning(class_msg).on_line(1).in_column(1)
|
16
16
|
end
|
17
17
|
end
|
@@ -24,7 +24,7 @@ describe 'documentation' do
|
|
24
24
|
END
|
25
25
|
end
|
26
26
|
|
27
|
-
it '
|
27
|
+
it 'does not detect any problems' do
|
28
28
|
expect(problems).to have(0).problems
|
29
29
|
end
|
30
30
|
end
|
@@ -38,11 +38,11 @@ describe 'documentation' do
|
|
38
38
|
END
|
39
39
|
end
|
40
40
|
|
41
|
-
it '
|
41
|
+
it 'only detects a single problem' do
|
42
42
|
expect(problems).to have(1).problem
|
43
43
|
end
|
44
44
|
|
45
|
-
it '
|
45
|
+
it 'creates a warning' do
|
46
46
|
expect(problems).to contain_warning(class_msg).on_line(3).in_column(9)
|
47
47
|
end
|
48
48
|
end
|
@@ -50,11 +50,11 @@ describe 'documentation' do
|
|
50
50
|
describe 'undocumented defined type' do
|
51
51
|
let(:code) { 'define test {}' }
|
52
52
|
|
53
|
-
it '
|
53
|
+
it 'only detects a single problem' do
|
54
54
|
expect(problems).to have(1).problem
|
55
55
|
end
|
56
56
|
|
57
|
-
it '
|
57
|
+
it 'creates a warning' do
|
58
58
|
expect(problems).to contain_warning(define_msg).on_line(1).in_column(1)
|
59
59
|
end
|
60
60
|
end
|
@@ -67,7 +67,7 @@ describe 'documentation' do
|
|
67
67
|
END
|
68
68
|
end
|
69
69
|
|
70
|
-
it '
|
70
|
+
it 'does not detect any problems' do
|
71
71
|
expect(problems).to have(0).problems
|
72
72
|
end
|
73
73
|
end
|
@@ -7,11 +7,11 @@ describe 'unquoted_node_name' do
|
|
7
7
|
context 'unquoted node name' do
|
8
8
|
let(:code) { 'node foo { }' }
|
9
9
|
|
10
|
-
it '
|
10
|
+
it 'only detects a single problem' do
|
11
11
|
expect(problems).to have(1).problem
|
12
12
|
end
|
13
13
|
|
14
|
-
it '
|
14
|
+
it 'creates a warning' do
|
15
15
|
expect(problems).to contain_warning(msg).on_line(1).in_column(6)
|
16
16
|
end
|
17
17
|
end
|
@@ -19,7 +19,7 @@ describe 'unquoted_node_name' do
|
|
19
19
|
context 'default node' do
|
20
20
|
let(:code) { 'node default { }' }
|
21
21
|
|
22
|
-
it '
|
22
|
+
it 'does not detect any problems' do
|
23
23
|
expect(problems).to have(0).problems
|
24
24
|
end
|
25
25
|
end
|
@@ -27,7 +27,7 @@ describe 'unquoted_node_name' do
|
|
27
27
|
context 'single quoted node name' do
|
28
28
|
let(:code) { "node 'foo' { }" }
|
29
29
|
|
30
|
-
it '
|
30
|
+
it 'does not detect any problems' do
|
31
31
|
expect(problems).to have(0).problems
|
32
32
|
end
|
33
33
|
end
|
@@ -35,7 +35,7 @@ describe 'unquoted_node_name' do
|
|
35
35
|
context 'regex node name' do
|
36
36
|
let(:code) { 'node /foo/ { }' }
|
37
37
|
|
38
|
-
it '
|
38
|
+
it 'does not detect any problems' do
|
39
39
|
expect(problems).to have(0).problems
|
40
40
|
end
|
41
41
|
end
|
@@ -43,11 +43,11 @@ describe 'unquoted_node_name' do
|
|
43
43
|
context 'multiple bare node names' do
|
44
44
|
let(:code) { 'node foo, bar, baz { }' }
|
45
45
|
|
46
|
-
it '
|
46
|
+
it 'detects 3 problems' do
|
47
47
|
expect(problems).to have(3).problems
|
48
48
|
end
|
49
49
|
|
50
|
-
it '
|
50
|
+
it 'creates 3 warnings' do
|
51
51
|
expect(problems).to contain_warning(msg).on_line(1).in_column(6)
|
52
52
|
expect(problems).to contain_warning(msg).on_line(1).in_column(11)
|
53
53
|
expect(problems).to contain_warning(msg).on_line(1).in_column(16)
|
@@ -57,11 +57,11 @@ describe 'unquoted_node_name' do
|
|
57
57
|
context 'mixed node name types' do
|
58
58
|
let(:code) { "node foo, 'bar', baz { }" }
|
59
59
|
|
60
|
-
it '
|
60
|
+
it 'detects 2 problems' do
|
61
61
|
expect(problems).to have(2).problems
|
62
62
|
end
|
63
63
|
|
64
|
-
it '
|
64
|
+
it 'creates 2 warnings' do
|
65
65
|
expect(problems).to contain_warning(msg).on_line(1).in_column(6)
|
66
66
|
expect(problems).to contain_warning(msg).on_line(1).in_column(18)
|
67
67
|
end
|
@@ -70,11 +70,11 @@ describe 'unquoted_node_name' do
|
|
70
70
|
context 'multiple node blocks' do
|
71
71
|
let(:code) { 'node foo { } node bar { }' }
|
72
72
|
|
73
|
-
it '
|
73
|
+
it 'detects 2 problems' do
|
74
74
|
expect(problems).to have(2).problems
|
75
75
|
end
|
76
76
|
|
77
|
-
it '
|
77
|
+
it 'creates 2 warnings' do
|
78
78
|
expect(problems).to contain_warning(msg).on_line(1).in_column(6)
|
79
79
|
expect(problems).to contain_warning(msg).on_line(1).in_column(19)
|
80
80
|
end
|
@@ -83,37 +83,37 @@ describe 'unquoted_node_name' do
|
|
83
83
|
context 'incomplete node block' do
|
84
84
|
let(:code) { 'node foo' }
|
85
85
|
|
86
|
-
it '
|
86
|
+
it 'detects a problem' do
|
87
87
|
expect(problems).to have(1).problem
|
88
88
|
end
|
89
89
|
|
90
|
-
it '
|
90
|
+
it 'creates 1 error' do
|
91
91
|
expect(problems).to contain_error('Syntax error (try running `puppet parser validate <file>`)').on_line(1).in_column(1)
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
96
|
context 'with fix enabled' do
|
97
|
-
before do
|
97
|
+
before(:each) do
|
98
98
|
PuppetLint.configuration.fix = true
|
99
99
|
end
|
100
100
|
|
101
|
-
after do
|
101
|
+
after(:each) do
|
102
102
|
PuppetLint.configuration.fix = false
|
103
103
|
end
|
104
104
|
|
105
105
|
context 'unquoted node name' do
|
106
106
|
let(:code) { 'node foo { }' }
|
107
107
|
|
108
|
-
it '
|
108
|
+
it 'only detects a single problem' do
|
109
109
|
expect(problems).to have(1).problem
|
110
110
|
end
|
111
111
|
|
112
|
-
it '
|
112
|
+
it 'fixes the manifest' do
|
113
113
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(6)
|
114
114
|
end
|
115
115
|
|
116
|
-
it '
|
116
|
+
it 'quotes the node name' do
|
117
117
|
expect(manifest).to eq("node 'foo' { }")
|
118
118
|
end
|
119
119
|
end
|
@@ -122,17 +122,17 @@ describe 'unquoted_node_name' do
|
|
122
122
|
let(:code) { 'node foo, bar, baz { }' }
|
123
123
|
let(:fixed) { "node 'foo', 'bar', 'baz' { }" }
|
124
124
|
|
125
|
-
it '
|
125
|
+
it 'detects 3 problems' do
|
126
126
|
expect(problems).to have(3).problems
|
127
127
|
end
|
128
128
|
|
129
|
-
it '
|
129
|
+
it 'fixes the 3 problems' do
|
130
130
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(6)
|
131
131
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(11)
|
132
132
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(16)
|
133
133
|
end
|
134
134
|
|
135
|
-
it '
|
135
|
+
it 'quotes all three node names' do
|
136
136
|
expect(manifest).to eq(fixed)
|
137
137
|
end
|
138
138
|
end
|
@@ -141,16 +141,16 @@ describe 'unquoted_node_name' do
|
|
141
141
|
let(:code) { "node foo, 'bar', baz { }" }
|
142
142
|
let(:fixed) { "node 'foo', 'bar', 'baz' { }" }
|
143
143
|
|
144
|
-
it '
|
144
|
+
it 'detects 2 problems' do
|
145
145
|
expect(problems).to have(2).problems
|
146
146
|
end
|
147
147
|
|
148
|
-
it '
|
148
|
+
it 'fixes the 2 problems' do
|
149
149
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(6)
|
150
150
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(18)
|
151
151
|
end
|
152
152
|
|
153
|
-
it '
|
153
|
+
it 'quotes the 2 unquoted node names' do
|
154
154
|
expect(manifest).to eq(fixed)
|
155
155
|
end
|
156
156
|
end
|