puppet-lint 2.5.0 → 3.0.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/.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 +63 -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 +28 -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 +69 -120
- data/CHANGELOG.md +0 -1130
- data/spec/puppet-lint/configuration_spec.rb +0 -66
- data/spec/puppet-lint_spec.rb +0 -16
@@ -15,11 +15,11 @@ describe 'duplicate_params' 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 an error' do
|
23
23
|
expect(problems).to contain_error(msg).on_line(5).in_column(11)
|
24
24
|
end
|
25
25
|
end
|
@@ -36,7 +36,7 @@ describe 'duplicate_params' do
|
|
36
36
|
END
|
37
37
|
end
|
38
38
|
|
39
|
-
it '
|
39
|
+
it 'does not detect any errors' do
|
40
40
|
expect(problems).to have(0).problems
|
41
41
|
end
|
42
42
|
end
|
@@ -53,11 +53,11 @@ describe 'duplicate_params' do
|
|
53
53
|
END
|
54
54
|
end
|
55
55
|
|
56
|
-
it '
|
56
|
+
it 'only detects a single error' do
|
57
57
|
expect(problems).to have(1).problem
|
58
58
|
end
|
59
59
|
|
60
|
-
it '
|
60
|
+
it 'creates an error' do
|
61
61
|
expect(problems).to contain_error(msg).on_line(4).in_column(15)
|
62
62
|
end
|
63
63
|
end
|
@@ -76,11 +76,11 @@ describe 'duplicate_params' do
|
|
76
76
|
END
|
77
77
|
end
|
78
78
|
|
79
|
-
it '
|
79
|
+
it 'only detects a single problem' do
|
80
80
|
expect(problems).to have(1).problem
|
81
81
|
end
|
82
82
|
|
83
|
-
it '
|
83
|
+
it 'creates an error' do
|
84
84
|
expect(problems).to contain_error(msg).on_line(7).in_column(11)
|
85
85
|
end
|
86
86
|
end
|
@@ -95,7 +95,7 @@ describe 'duplicate_params' do
|
|
95
95
|
END
|
96
96
|
end
|
97
97
|
|
98
|
-
it '
|
98
|
+
it 'does not detect any problems' do
|
99
99
|
expect(problems).to have(0).problems
|
100
100
|
end
|
101
101
|
end
|
@@ -103,7 +103,7 @@ describe 'duplicate_params' do
|
|
103
103
|
context 'colon as last token in file' do
|
104
104
|
let(:code) { '}:' }
|
105
105
|
|
106
|
-
it '
|
106
|
+
it 'does not detect any problems' do
|
107
107
|
expect(problems).to have(0).problems
|
108
108
|
end
|
109
109
|
end
|
data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/ensure_first_param_spec.rb
RENAMED
@@ -7,7 +7,7 @@ describe 'ensure_first_param' do
|
|
7
7
|
context 'ensure as only attr in a single line resource' do
|
8
8
|
let(:code) { "file { 'foo': ensure => present }" }
|
9
9
|
|
10
|
-
it '
|
10
|
+
it 'does not detect any problems' do
|
11
11
|
expect(problems).to have(0).problems
|
12
12
|
end
|
13
13
|
end
|
@@ -21,7 +21,7 @@ describe 'ensure_first_param' do
|
|
21
21
|
END
|
22
22
|
end
|
23
23
|
|
24
|
-
it '
|
24
|
+
it 'does not detect any problems' do
|
25
25
|
expect(problems).to have(0).problems
|
26
26
|
end
|
27
27
|
end
|
@@ -36,11 +36,11 @@ describe 'ensure_first_param' do
|
|
36
36
|
END
|
37
37
|
end
|
38
38
|
|
39
|
-
it '
|
39
|
+
it 'only detects a single problem' do
|
40
40
|
expect(problems).to have(1).problem
|
41
41
|
end
|
42
42
|
|
43
|
-
it '
|
43
|
+
it 'creates a warning' do
|
44
44
|
expect(problems).to contain_warning(msg).on_line(3).in_column(13)
|
45
45
|
end
|
46
46
|
end
|
@@ -55,7 +55,7 @@ describe 'ensure_first_param' do
|
|
55
55
|
END
|
56
56
|
end
|
57
57
|
|
58
|
-
it '
|
58
|
+
it 'does not detect any problems' do
|
59
59
|
expect(problems).to have(0).problems
|
60
60
|
end
|
61
61
|
end
|
@@ -76,7 +76,7 @@ describe 'ensure_first_param' do
|
|
76
76
|
END
|
77
77
|
end
|
78
78
|
|
79
|
-
it '
|
79
|
+
it 'does not detect any problems' do
|
80
80
|
expect(problems).to have(0).problems
|
81
81
|
end
|
82
82
|
end
|
@@ -92,25 +92,25 @@ describe 'ensure_first_param' do
|
|
92
92
|
END
|
93
93
|
end
|
94
94
|
|
95
|
-
it '
|
95
|
+
it 'does not detect any problems' do
|
96
96
|
expect(problems).to have(0).problems
|
97
97
|
end
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
101
|
context 'with fix enabled' do
|
102
|
-
before do
|
102
|
+
before(:each) do
|
103
103
|
PuppetLint.configuration.fix = true
|
104
104
|
end
|
105
105
|
|
106
|
-
after do
|
106
|
+
after(:each) do
|
107
107
|
PuppetLint.configuration.fix = false
|
108
108
|
end
|
109
109
|
|
110
110
|
context 'ensure as only attr in a single line resource' do
|
111
111
|
let(:code) { "file { 'foo': ensure => present }" }
|
112
112
|
|
113
|
-
it '
|
113
|
+
it 'does not detect any problems' do
|
114
114
|
expect(problems).to have(0).problems
|
115
115
|
end
|
116
116
|
end
|
@@ -124,7 +124,7 @@ describe 'ensure_first_param' do
|
|
124
124
|
END
|
125
125
|
end
|
126
126
|
|
127
|
-
it '
|
127
|
+
it 'does not detect any problems' do
|
128
128
|
expect(problems).to have(0).problems
|
129
129
|
end
|
130
130
|
end
|
@@ -148,15 +148,15 @@ describe 'ensure_first_param' do
|
|
148
148
|
END
|
149
149
|
end
|
150
150
|
|
151
|
-
it '
|
151
|
+
it 'only detects a single problem' do
|
152
152
|
expect(problems).to have(1).problem
|
153
153
|
end
|
154
154
|
|
155
|
-
it '
|
155
|
+
it 'creates a warning' do
|
156
156
|
expect(problems).to contain_fixed(msg).on_line(3).in_column(13)
|
157
157
|
end
|
158
158
|
|
159
|
-
it '
|
159
|
+
it 'makes ensure the first attr' do
|
160
160
|
expect(manifest).to eq(fixed)
|
161
161
|
end
|
162
162
|
end
|
@@ -171,7 +171,7 @@ describe 'ensure_first_param' do
|
|
171
171
|
END
|
172
172
|
end
|
173
173
|
|
174
|
-
it '
|
174
|
+
it 'does not detect any problems' do
|
175
175
|
expect(problems).to have(0).problems
|
176
176
|
end
|
177
177
|
end
|
@@ -192,7 +192,7 @@ describe 'ensure_first_param' do
|
|
192
192
|
END
|
193
193
|
end
|
194
194
|
|
195
|
-
it '
|
195
|
+
it 'does not detect any problems' do
|
196
196
|
expect(problems).to have(0).problems
|
197
197
|
end
|
198
198
|
end
|
@@ -228,15 +228,15 @@ describe 'ensure_first_param' do
|
|
228
228
|
END
|
229
229
|
end
|
230
230
|
|
231
|
-
it '
|
231
|
+
it 'detects a problem' do
|
232
232
|
expect(problems).to have(1).problem
|
233
233
|
end
|
234
234
|
|
235
|
-
it '
|
235
|
+
it 'fixes the problem' do
|
236
236
|
expect(problems).to contain_fixed(msg).on_line(3).in_column(13)
|
237
237
|
end
|
238
238
|
|
239
|
-
it '
|
239
|
+
it 'moves the whole ensure parameter to the top' do
|
240
240
|
expect(manifest).to eq(fixed)
|
241
241
|
end
|
242
242
|
end
|
data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/ensure_not_symlink_target_spec.rb
RENAMED
@@ -14,7 +14,7 @@ describe 'ensure_not_symlink_target' do
|
|
14
14
|
END
|
15
15
|
end
|
16
16
|
|
17
|
-
it '
|
17
|
+
it 'does not detect any problems' do
|
18
18
|
expect(problems).to have(0).problems
|
19
19
|
end
|
20
20
|
end
|
@@ -28,22 +28,22 @@ describe 'ensure_not_symlink_target' 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(2).in_column(23)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
context 'with fix enabled' do
|
42
|
-
before do
|
42
|
+
before(:each) do
|
43
43
|
PuppetLint.configuration.fix = true
|
44
44
|
end
|
45
45
|
|
46
|
-
after do
|
46
|
+
after(:each) do
|
47
47
|
PuppetLint.configuration.fix = false
|
48
48
|
end
|
49
49
|
|
@@ -57,11 +57,11 @@ describe 'ensure_not_symlink_target' do
|
|
57
57
|
END
|
58
58
|
end
|
59
59
|
|
60
|
-
it '
|
60
|
+
it 'does not detect any problems' do
|
61
61
|
expect(problems).to have(0).problems
|
62
62
|
end
|
63
63
|
|
64
|
-
it '
|
64
|
+
it 'does not modify the manifest' do
|
65
65
|
expect(manifest).to eq(code)
|
66
66
|
end
|
67
67
|
end
|
@@ -84,15 +84,15 @@ describe 'ensure_not_symlink_target' do
|
|
84
84
|
END
|
85
85
|
end
|
86
86
|
|
87
|
-
it '
|
87
|
+
it 'only detects a single problem' do
|
88
88
|
expect(problems).to have(1).problem
|
89
89
|
end
|
90
90
|
|
91
|
-
it '
|
91
|
+
it 'fixes the problem' do
|
92
92
|
expect(problems).to contain_fixed(msg).on_line(2).in_column(23)
|
93
93
|
end
|
94
94
|
|
95
|
-
it '
|
95
|
+
it 'creates a new target param' do
|
96
96
|
expect(manifest).to eq(fixed)
|
97
97
|
end
|
98
98
|
end
|
@@ -7,11 +7,11 @@ describe 'file_mode' do
|
|
7
7
|
context '3 digit file mode' do
|
8
8
|
let(:code) { "file { 'foo': mode => '777' }" }
|
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(23)
|
16
16
|
end
|
17
17
|
end
|
@@ -19,7 +19,7 @@ describe 'file_mode' do
|
|
19
19
|
context '4 digit file mode' do
|
20
20
|
let(:code) { "file { 'foo': mode => '0777' }" }
|
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 'file_mode' do
|
|
27
27
|
context 'file mode as a variable' do
|
28
28
|
let(:code) { "file { 'foo': mode => $file_mode }" }
|
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 'file_mode' do
|
|
35
35
|
context 'symbolic file mode' do
|
36
36
|
let(:code) { "file { 'foo': mode => 'u=rw,og=r' }" }
|
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,7 +43,7 @@ describe 'file_mode' do
|
|
43
43
|
context 'file mode undef unquoted' do
|
44
44
|
let(:code) { "file { 'foo': mode => undef }" }
|
45
45
|
|
46
|
-
it '
|
46
|
+
it 'does not detect any problems' do
|
47
47
|
expect(problems).to have(0).problems
|
48
48
|
end
|
49
49
|
end
|
@@ -51,11 +51,11 @@ describe 'file_mode' do
|
|
51
51
|
context 'file mode undef quoted' do
|
52
52
|
let(:code) { "file { 'foo': mode => 'undef' }" }
|
53
53
|
|
54
|
-
it '
|
54
|
+
it 'only detects a single problem' do
|
55
55
|
expect(problems).to have(1).problem
|
56
56
|
end
|
57
57
|
|
58
|
-
it '
|
58
|
+
it 'creates a warning' do
|
59
59
|
expect(problems).to contain_warning(msg).on_line(1).in_column(23)
|
60
60
|
end
|
61
61
|
end
|
@@ -63,7 +63,7 @@ describe 'file_mode' do
|
|
63
63
|
context 'mode as audit value' do
|
64
64
|
let(:code) { "file { '/etc/passwd': audit => [ owner, mode ], }" }
|
65
65
|
|
66
|
-
it '
|
66
|
+
it 'does not detect any problems' do
|
67
67
|
expect(problems).to have(0).problems
|
68
68
|
end
|
69
69
|
end
|
@@ -71,11 +71,11 @@ describe 'file_mode' do
|
|
71
71
|
context '3 digit concat mode' do
|
72
72
|
let(:code) { "concat { 'foo': mode => '777' }" }
|
73
73
|
|
74
|
-
it '
|
74
|
+
it 'only detects a single problem' do
|
75
75
|
expect(problems).to have(1).problem
|
76
76
|
end
|
77
77
|
|
78
|
-
it '
|
78
|
+
it 'creates a warning' do
|
79
79
|
expect(problems).to contain_warning(msg).on_line(1).in_column(25)
|
80
80
|
end
|
81
81
|
end
|
@@ -83,7 +83,7 @@ describe 'file_mode' do
|
|
83
83
|
context '4 digit concat mode' do
|
84
84
|
let(:code) { "concat { 'foo': mode => '0777' }" }
|
85
85
|
|
86
|
-
it '
|
86
|
+
it 'does not detect any problems' do
|
87
87
|
expect(problems).to have(0).problems
|
88
88
|
end
|
89
89
|
end
|
@@ -91,7 +91,7 @@ describe 'file_mode' do
|
|
91
91
|
context 'concat mode as a variable' do
|
92
92
|
let(:code) { "concat { 'foo': mode => $concat_mode }" }
|
93
93
|
|
94
|
-
it '
|
94
|
+
it 'does not detect any problems' do
|
95
95
|
expect(problems).to have(0).problems
|
96
96
|
end
|
97
97
|
end
|
@@ -99,7 +99,7 @@ describe 'file_mode' do
|
|
99
99
|
context 'symbolic concat mode' do
|
100
100
|
let(:code) { "concat { 'foo': mode => 'u=rw,og=r' }" }
|
101
101
|
|
102
|
-
it '
|
102
|
+
it 'does not detect any problems' do
|
103
103
|
expect(problems).to have(0).problems
|
104
104
|
end
|
105
105
|
end
|
@@ -107,7 +107,7 @@ describe 'file_mode' do
|
|
107
107
|
context 'concat mode undef unquoted' do
|
108
108
|
let(:code) { "concat { 'foo': mode => undef }" }
|
109
109
|
|
110
|
-
it '
|
110
|
+
it 'does not detect any problems' do
|
111
111
|
expect(problems).to have(0).problems
|
112
112
|
end
|
113
113
|
end
|
@@ -115,11 +115,11 @@ describe 'file_mode' do
|
|
115
115
|
context 'concat mode undef quoted' do
|
116
116
|
let(:code) { "concat { 'foo': mode => 'undef' }" }
|
117
117
|
|
118
|
-
it '
|
118
|
+
it 'only detects a single problem' do
|
119
119
|
expect(problems).to have(1).problem
|
120
120
|
end
|
121
121
|
|
122
|
-
it '
|
122
|
+
it 'creates a warning' do
|
123
123
|
expect(problems).to contain_warning(msg).on_line(1).in_column(25)
|
124
124
|
end
|
125
125
|
end
|
@@ -127,7 +127,7 @@ describe 'file_mode' do
|
|
127
127
|
context 'mode as audit value' do
|
128
128
|
let(:code) { "concat { '/etc/passwd': audit => [ owner, mode ], }" }
|
129
129
|
|
130
|
-
it '
|
130
|
+
it 'does not detect any problems' do
|
131
131
|
expect(problems).to have(0).problems
|
132
132
|
end
|
133
133
|
end
|
@@ -135,7 +135,7 @@ describe 'file_mode' do
|
|
135
135
|
context 'mode as a function return value' do
|
136
136
|
let(:code) { "file { 'foo': mode => lookup('bar'), }" }
|
137
137
|
|
138
|
-
it '
|
138
|
+
it 'does not detect any problems' do
|
139
139
|
expect(problems).to have(0).problems
|
140
140
|
end
|
141
141
|
end
|
@@ -155,11 +155,11 @@ describe 'file_mode' do
|
|
155
155
|
END
|
156
156
|
end
|
157
157
|
|
158
|
-
it '
|
158
|
+
it 'detects 3 problems' do
|
159
159
|
expect(problems).to have(3).problems
|
160
160
|
end
|
161
161
|
|
162
|
-
it '
|
162
|
+
it 'creates three warnings' do
|
163
163
|
expect(problems).to contain_warning(sprintf(msg)).on_line(4).in_column(23)
|
164
164
|
expect(problems).to contain_warning(sprintf(msg)).on_line(6).in_column(23)
|
165
165
|
expect(problems).to contain_warning(sprintf(msg)).on_line(8).in_column(23)
|
@@ -168,26 +168,26 @@ describe 'file_mode' do
|
|
168
168
|
end
|
169
169
|
|
170
170
|
context 'with fix enabled' do
|
171
|
-
before do
|
171
|
+
before(:each) do
|
172
172
|
PuppetLint.configuration.fix = true
|
173
173
|
end
|
174
174
|
|
175
|
-
after do
|
175
|
+
after(:each) do
|
176
176
|
PuppetLint.configuration.fix = false
|
177
177
|
end
|
178
178
|
|
179
179
|
context '3 digit file mode' do
|
180
180
|
let(:code) { "file { 'foo': mode => '777' }" }
|
181
181
|
|
182
|
-
it '
|
182
|
+
it 'only detects a single problem' do
|
183
183
|
expect(problems).to have(1).problem
|
184
184
|
end
|
185
185
|
|
186
|
-
it '
|
186
|
+
it 'fixes the manifest' do
|
187
187
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(23)
|
188
188
|
end
|
189
189
|
|
190
|
-
it '
|
190
|
+
it 'zeroe pads the file mode' do
|
191
191
|
expect(manifest).to eq("file { 'foo': mode => '0777' }")
|
192
192
|
end
|
193
193
|
end
|
@@ -195,15 +195,15 @@ describe 'file_mode' do
|
|
195
195
|
context 'file mode undef quoted' do
|
196
196
|
let(:code) { "file { 'foo': mode => 'undef' }" }
|
197
197
|
|
198
|
-
it '
|
198
|
+
it 'only detects a single problem' do
|
199
199
|
expect(problems).to have(1).problem
|
200
200
|
end
|
201
201
|
|
202
|
-
it '
|
202
|
+
it 'creates a warning' do
|
203
203
|
expect(problems).to contain_warning(msg).on_line(1).in_column(23)
|
204
204
|
end
|
205
205
|
|
206
|
-
it '
|
206
|
+
it 'does not modify the original manifest' do
|
207
207
|
expect(manifest).to eq(code)
|
208
208
|
end
|
209
209
|
end
|
@@ -211,15 +211,15 @@ describe 'file_mode' do
|
|
211
211
|
context '3 digit concat mode' do
|
212
212
|
let(:code) { "concat { 'foo': mode => '777' }" }
|
213
213
|
|
214
|
-
it '
|
214
|
+
it 'only detects a single problem' do
|
215
215
|
expect(problems).to have(1).problem
|
216
216
|
end
|
217
217
|
|
218
|
-
it '
|
218
|
+
it 'fixes the manifest' do
|
219
219
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(25)
|
220
220
|
end
|
221
221
|
|
222
|
-
it '
|
222
|
+
it 'zero pads the concat mode' do
|
223
223
|
expect(manifest).to eq("concat { 'foo': mode => '0777' }")
|
224
224
|
end
|
225
225
|
end
|
@@ -227,15 +227,15 @@ describe 'file_mode' do
|
|
227
227
|
context 'concat mode undef quoted' do
|
228
228
|
let(:code) { "concat { 'foo': mode => 'undef' }" }
|
229
229
|
|
230
|
-
it '
|
230
|
+
it 'only detects a single problem' do
|
231
231
|
expect(problems).to have(1).problem
|
232
232
|
end
|
233
233
|
|
234
|
-
it '
|
234
|
+
it 'creates a warning' do
|
235
235
|
expect(problems).to contain_warning(msg).on_line(1).in_column(25)
|
236
236
|
end
|
237
237
|
|
238
|
-
it '
|
238
|
+
it 'does not modify the original manifest' do
|
239
239
|
expect(manifest).to eq(code)
|
240
240
|
end
|
241
241
|
end
|
@@ -243,11 +243,11 @@ describe 'file_mode' do
|
|
243
243
|
context 'mode as a function return value' do
|
244
244
|
let(:code) { "file { 'foo': mode => lookup('bar'), }" }
|
245
245
|
|
246
|
-
it '
|
246
|
+
it 'does not detect any problems' do
|
247
247
|
expect(problems).to have(0).problems
|
248
248
|
end
|
249
249
|
|
250
|
-
it '
|
250
|
+
it 'does not change the manifest' do
|
251
251
|
expect(manifest).to eq(code)
|
252
252
|
end
|
253
253
|
end
|
@@ -281,17 +281,17 @@ describe 'file_mode' do
|
|
281
281
|
END
|
282
282
|
end
|
283
283
|
|
284
|
-
it '
|
284
|
+
it 'detects 3 problems' do
|
285
285
|
expect(problems).to have(3).problems
|
286
286
|
end
|
287
287
|
|
288
|
-
it '
|
288
|
+
it 'fixes 3 problems' do
|
289
289
|
expect(problems).to contain_fixed(msg).on_line(4).in_column(23)
|
290
290
|
expect(problems).to contain_fixed(msg).on_line(6).in_column(23)
|
291
291
|
expect(problems).to contain_fixed(msg).on_line(8).in_column(23)
|
292
292
|
end
|
293
293
|
|
294
|
-
it '
|
294
|
+
it 'zero pads the file modes and change them to strings' do
|
295
295
|
expect(manifest).to eq(fixed)
|
296
296
|
end
|
297
297
|
end
|