puppet-lint 2.5.0 → 3.0.0
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 +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
data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/arrow_on_right_operand_line_spec.rb
RENAMED
@@ -12,7 +12,7 @@ describe 'arrow_on_right_operand_line' do
|
|
12
12
|
END
|
13
13
|
end
|
14
14
|
|
15
|
-
it '
|
15
|
+
it 'does not detect any problems' do
|
16
16
|
expect(problems).to have(0).problems
|
17
17
|
end
|
18
18
|
end
|
@@ -25,20 +25,20 @@ describe 'arrow_on_right_operand_line' do
|
|
25
25
|
END
|
26
26
|
end
|
27
27
|
|
28
|
-
it '
|
28
|
+
it 'detects a problem' do
|
29
29
|
expect(problems).to have(1).problem
|
30
30
|
end
|
31
31
|
|
32
|
-
it '
|
32
|
+
it 'creates a warning' do
|
33
33
|
expect(problems).to contain_warning(msg).on_line(1).in_column(31)
|
34
34
|
end
|
35
35
|
|
36
36
|
context 'with fix enabled' do
|
37
|
-
before do
|
37
|
+
before(:each) do
|
38
38
|
PuppetLint.configuration.fix = true
|
39
39
|
end
|
40
40
|
|
41
|
-
after do
|
41
|
+
after(:each) do
|
42
42
|
PuppetLint.configuration.fix = false
|
43
43
|
end
|
44
44
|
|
@@ -49,11 +49,11 @@ describe 'arrow_on_right_operand_line' do
|
|
49
49
|
END
|
50
50
|
end
|
51
51
|
|
52
|
-
it '
|
52
|
+
it 'fixes the problem' do
|
53
53
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(31)
|
54
54
|
end
|
55
55
|
|
56
|
-
it '
|
56
|
+
it 'moves the arrow to before the right operand' do
|
57
57
|
expect(manifest).to eq(fixed)
|
58
58
|
end
|
59
59
|
end
|
@@ -67,7 +67,7 @@ describe 'arrow_on_right_operand_line' 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
|
@@ -83,11 +83,11 @@ describe 'arrow_on_right_operand_line' do
|
|
83
83
|
END
|
84
84
|
end
|
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 a warning' do
|
91
91
|
expect(problems).to contain_warning(msg).on_line(1).in_column(30)
|
92
92
|
end
|
93
93
|
|
@@ -110,11 +110,11 @@ describe 'arrow_on_right_operand_line' do
|
|
110
110
|
END
|
111
111
|
end
|
112
112
|
|
113
|
-
it '
|
113
|
+
it 'fixes the problem' do
|
114
114
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(30)
|
115
115
|
end
|
116
116
|
|
117
|
-
it '
|
117
|
+
it 'moves the arrow to before the right operand' do
|
118
118
|
expect(manifest).to eq(fixed)
|
119
119
|
end
|
120
120
|
end
|
@@ -128,11 +128,11 @@ describe 'arrow_on_right_operand_line' do
|
|
128
128
|
END
|
129
129
|
end
|
130
130
|
|
131
|
-
it '
|
131
|
+
it 'detects a problem' do
|
132
132
|
expect(problems).to have(1).problem
|
133
133
|
end
|
134
134
|
|
135
|
-
it '
|
135
|
+
it 'creates a warning' do
|
136
136
|
expect(problems).to contain_warning(msg).on_line(1).in_column(30)
|
137
137
|
end
|
138
138
|
|
@@ -152,11 +152,11 @@ describe 'arrow_on_right_operand_line' do
|
|
152
152
|
END
|
153
153
|
end
|
154
154
|
|
155
|
-
it '
|
155
|
+
it 'fixes the problem' do
|
156
156
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(30)
|
157
157
|
end
|
158
158
|
|
159
|
-
it '
|
159
|
+
it 'moves the arrow to before the right operand' do
|
160
160
|
expect(manifest).to eq(fixed)
|
161
161
|
end
|
162
162
|
end
|
@@ -5,7 +5,7 @@ describe 'autoloader_layout' do
|
|
5
5
|
let(:code) { 'class foo::bar { }' }
|
6
6
|
let(:path) { 'foo/manifests/bar.pp' }
|
7
7
|
|
8
|
-
it '
|
8
|
+
it 'does not detect any problems' do
|
9
9
|
expect(problems).to have(0).problems
|
10
10
|
end
|
11
11
|
end
|
@@ -14,7 +14,7 @@ describe 'autoloader_layout' do
|
|
14
14
|
let(:code) { 'define foo::bar::baz() { }' }
|
15
15
|
let(:path) { 'foo/manifests/bar/baz.pp' }
|
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
|
@@ -23,7 +23,7 @@ describe 'autoloader_layout' do
|
|
23
23
|
let(:code) { 'class foo { }' }
|
24
24
|
let(:path) { 'foo/manifests/init.pp' }
|
25
25
|
|
26
|
-
it '
|
26
|
+
it 'does not detect any problems' do
|
27
27
|
expect(problems).to have(0).problems
|
28
28
|
end
|
29
29
|
end
|
@@ -33,11 +33,11 @@ describe 'autoloader_layout' do
|
|
33
33
|
let(:path) { 'foo/manifests/init.pp' }
|
34
34
|
let(:msg) { 'foo::bar not in autoload module layout' }
|
35
35
|
|
36
|
-
it '
|
36
|
+
it 'only detects a single problem' do
|
37
37
|
expect(problems).to have(1).problem
|
38
38
|
end
|
39
39
|
|
40
|
-
it '
|
40
|
+
it 'creates an error' do
|
41
41
|
expect(problems).to contain_error(msg).on_line(1).in_column(7)
|
42
42
|
end
|
43
43
|
end
|
@@ -55,7 +55,7 @@ describe 'autoloader_layout' do
|
|
55
55
|
|
56
56
|
let(:path) { 'bar/manifests/init.pp' }
|
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
|
@@ -64,41 +64,41 @@ describe 'autoloader_layout' do
|
|
64
64
|
let(:code) { 'class foo { }' }
|
65
65
|
let(:path) { 'puppet-foo/manifests/init.pp' }
|
66
66
|
|
67
|
-
it '
|
67
|
+
it 'detects a single problem' do
|
68
68
|
expect(problems).to have(1).problems
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
72
|
context 'foo in puppet-foo/manifests/bar.pp with relative option' do
|
73
|
-
before do
|
73
|
+
before(:each) do
|
74
74
|
PuppetLint.configuration.relative = true
|
75
75
|
end
|
76
76
|
|
77
|
-
after do
|
77
|
+
after(:each) do
|
78
78
|
PuppetLint.configuration.relative = false
|
79
79
|
end
|
80
80
|
|
81
81
|
let(:code) { 'class foo { }' }
|
82
82
|
let(:path) { 'puppet-foo/manifests/bar.pp' }
|
83
83
|
|
84
|
-
it '
|
84
|
+
it 'detects a single problem' do
|
85
85
|
expect(problems).to have(1).problems
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
89
|
context 'foo in puppet-foo/manifests/init.pp with relative option' do
|
90
|
-
before do
|
90
|
+
before(:each) do
|
91
91
|
PuppetLint.configuration.relative = true
|
92
92
|
end
|
93
93
|
|
94
|
-
after do
|
94
|
+
after(:each) do
|
95
95
|
PuppetLint.configuration.relative = false
|
96
96
|
end
|
97
97
|
|
98
98
|
let(:code) { 'class foo { }' }
|
99
99
|
let(:path) { 'puppet-foo/manifests/init.pp' }
|
100
100
|
|
101
|
-
it '
|
101
|
+
it 'does not detect any problems' do
|
102
102
|
expect(problems).to have(0).problems
|
103
103
|
end
|
104
104
|
end
|
@@ -11,11 +11,11 @@ describe 'class_inherits_from_params_class' do
|
|
11
11
|
END
|
12
12
|
end
|
13
13
|
|
14
|
-
it '
|
14
|
+
it 'only detects a single problem' do
|
15
15
|
expect(problems).to have(1).problem
|
16
16
|
end
|
17
17
|
|
18
|
-
it '
|
18
|
+
it 'creates a warning' do
|
19
19
|
expect(problems).to contain_warning(msg).on_line(2).in_column(42)
|
20
20
|
end
|
21
21
|
end
|
@@ -32,7 +32,7 @@ describe 'class_inherits_from_params_class' do
|
|
32
32
|
END
|
33
33
|
end
|
34
34
|
|
35
|
-
it '
|
35
|
+
it 'does not detect any problems' do
|
36
36
|
expect(problems).to have(0).problems
|
37
37
|
end
|
38
38
|
end
|
@@ -10,7 +10,7 @@ describe 'code_on_top_scope' do
|
|
10
10
|
END
|
11
11
|
end
|
12
12
|
|
13
|
-
its(:problems) {
|
13
|
+
its(:problems) { is_expected.to be_empty }
|
14
14
|
end
|
15
15
|
|
16
16
|
describe 'new lines outside of class-define block' do
|
@@ -23,7 +23,7 @@ describe 'code_on_top_scope' do
|
|
23
23
|
END
|
24
24
|
end
|
25
25
|
|
26
|
-
its(:problems) {
|
26
|
+
its(:problems) { is_expected.to be_empty }
|
27
27
|
end
|
28
28
|
|
29
29
|
describe 'code outside class block' do
|
@@ -41,8 +41,8 @@ describe 'code_on_top_scope' do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
its(:problems) do
|
44
|
-
|
45
|
-
|
44
|
+
is_expected.to contain_warning('code outside of class or define block - include')
|
45
|
+
is_expected.to have(4).problems
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/inherits_across_namespaces_spec.rb
RENAMED
@@ -6,7 +6,7 @@ describe 'inherits_across_namespaces' do
|
|
6
6
|
context 'class inheriting from parent in same module namespace' do
|
7
7
|
let(:code) { 'class foo::bar inherits foo { }' }
|
8
8
|
|
9
|
-
it '
|
9
|
+
it 'does not detect any problems' do
|
10
10
|
expect(problems).to have(0).problems
|
11
11
|
end
|
12
12
|
end
|
@@ -14,7 +14,7 @@ describe 'inherits_across_namespaces' do
|
|
14
14
|
context 'class inheriting from sister in same module namespace' do
|
15
15
|
let(:code) { 'class foo::bar inherits foo::baz { }' }
|
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
|
@@ -22,11 +22,11 @@ describe 'inherits_across_namespaces' do
|
|
22
22
|
context 'class inheriting from another module namespace' do
|
23
23
|
let(:code) { 'class foo::bar inherits baz { }' }
|
24
24
|
|
25
|
-
it '
|
25
|
+
it 'only detects a single problem' do
|
26
26
|
expect(problems).to have(1).problem
|
27
27
|
end
|
28
28
|
|
29
|
-
it '
|
29
|
+
it 'creates a warning' do
|
30
30
|
expect(problems).to contain_warning(msg).on_line(1).in_column(25)
|
31
31
|
end
|
32
32
|
end
|
data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/name_contains_uppercase_spec.rb
RENAMED
@@ -6,11 +6,11 @@ describe 'names_containing_uppercase' do
|
|
6
6
|
let(:path) { 'foobar/manifests/init.pp' }
|
7
7
|
let(:class_msg) { "defined type 'FooBar' contains illegal uppercase" }
|
8
8
|
|
9
|
-
it '
|
9
|
+
it 'only detects a single problem' do
|
10
10
|
expect(problems).to have(1).problem
|
11
11
|
end
|
12
12
|
|
13
|
-
it '
|
13
|
+
it 'creates an error' do
|
14
14
|
expect(problems).to contain_error(class_msg).on_line(1).in_column(8)
|
15
15
|
end
|
16
16
|
end
|
@@ -20,11 +20,11 @@ describe 'names_containing_uppercase' do
|
|
20
20
|
let(:path) { 'foobar/manifests/init.pp' }
|
21
21
|
let(:class_msg) { "class 'FooBar' contains illegal uppercase" }
|
22
22
|
|
23
|
-
it '
|
23
|
+
it 'only detects a single problem' do
|
24
24
|
expect(problems).to have(1).problem
|
25
25
|
end
|
26
26
|
|
27
|
-
it '
|
27
|
+
it 'creates an error' do
|
28
28
|
expect(problems).to contain_error(class_msg).on_line(1).in_column(7)
|
29
29
|
end
|
30
30
|
end
|
@@ -34,30 +34,30 @@ describe 'names_containing_uppercase' do
|
|
34
34
|
let(:path) { 'foo/manifests/barfoo.pp' }
|
35
35
|
let(:class_msg) { "class 'Foo::BarFoo' contains illegal uppercase" }
|
36
36
|
|
37
|
-
it '
|
37
|
+
it 'only detects a single problem' do
|
38
38
|
expect(problems).to have(1).problem
|
39
39
|
end
|
40
40
|
|
41
|
-
it '
|
41
|
+
it 'creates an error' do
|
42
42
|
expect(problems).to contain_error(class_msg).on_line(1).in_column(7)
|
43
43
|
end
|
44
44
|
|
45
45
|
context 'check fix -' do
|
46
|
-
before do
|
46
|
+
before(:each) do
|
47
47
|
PuppetLint.configuration.fix = true
|
48
48
|
end
|
49
49
|
|
50
|
-
after do
|
50
|
+
after(:each) do
|
51
51
|
PuppetLint.configuration.fix = false
|
52
52
|
end
|
53
53
|
|
54
54
|
let(:fixed) { code.downcase }
|
55
55
|
|
56
|
-
it '
|
56
|
+
it 'creates an error' do
|
57
57
|
expect(problems).to contain_fixed(class_msg).on_line(1).in_column(7)
|
58
58
|
end
|
59
59
|
|
60
|
-
it '
|
60
|
+
it 'downcases the class name' do
|
61
61
|
expect(manifest).to eq(fixed)
|
62
62
|
end
|
63
63
|
end
|
data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/names_containing_dash_spec.rb
RENAMED
@@ -8,11 +8,11 @@ describe 'names_containing_dash' do
|
|
8
8
|
let(:code) { 'class foo-bar { }' }
|
9
9
|
let(:path) { 'foo-bar/manifests/init.pp' }
|
10
10
|
|
11
|
-
it '
|
11
|
+
it 'only detects a single problem' do
|
12
12
|
expect(problems).to have(1).problem
|
13
13
|
end
|
14
14
|
|
15
|
-
it '
|
15
|
+
it 'creates an error' do
|
16
16
|
expect(problems).to contain_error(class_msg).on_line(1).in_column(7)
|
17
17
|
end
|
18
18
|
end
|
@@ -21,11 +21,11 @@ describe 'names_containing_dash' do
|
|
21
21
|
let(:code) { 'define foo::foo-bar { }' }
|
22
22
|
let(:path) { 'foo/manifests/foo-bar.pp' }
|
23
23
|
|
24
|
-
it '
|
24
|
+
it 'only detect a single problem' do
|
25
25
|
expect(problems).to have(1).problem
|
26
26
|
end
|
27
27
|
|
28
|
-
it '
|
28
|
+
it 'creates an error' do
|
29
29
|
expect(problems).to contain_error(define_msg).on_line(1).in_column(8)
|
30
30
|
end
|
31
31
|
end
|
@@ -34,11 +34,11 @@ describe 'names_containing_dash' do
|
|
34
34
|
let(:code) { 'class foo::bar-foo { }' }
|
35
35
|
let(:path) { 'foo/manifests/bar-foo.pp' }
|
36
36
|
|
37
|
-
it '
|
37
|
+
it 'only detects a single problem' do
|
38
38
|
expect(problems).to have(1).problem
|
39
39
|
end
|
40
40
|
|
41
|
-
it '
|
41
|
+
it 'creates an error' do
|
42
42
|
expect(problems).to contain_error(class_msg).on_line(1).in_column(7)
|
43
43
|
end
|
44
44
|
end
|
@@ -51,7 +51,7 @@ describe 'names_containing_dash' do
|
|
51
51
|
END
|
52
52
|
end
|
53
53
|
|
54
|
-
it '
|
54
|
+
it 'creates an error' do
|
55
55
|
expect(problems).to contain_error(class_msg).on_line(2).in_column(15)
|
56
56
|
end
|
57
57
|
end
|
data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/nested_classes_or_defines_spec.rb
RENAMED
@@ -7,7 +7,7 @@ describe 'nested_classes_or_defines' do
|
|
7
7
|
context 'class on its own' do
|
8
8
|
let(:code) { 'class foo { }' }
|
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
|
@@ -22,11 +22,11 @@ describe 'nested_classes_or_defines' do
|
|
22
22
|
END
|
23
23
|
end
|
24
24
|
|
25
|
-
it '
|
25
|
+
it 'only detects a single problem' do
|
26
26
|
expect(problems).to have(1).problem
|
27
27
|
end
|
28
28
|
|
29
|
-
it '
|
29
|
+
it 'creates a warning' do
|
30
30
|
expect(problems).to contain_warning(class_msg).on_line(2).in_column(11)
|
31
31
|
end
|
32
32
|
end
|
@@ -42,7 +42,7 @@ describe 'nested_classes_or_defines' do
|
|
42
42
|
END
|
43
43
|
end
|
44
44
|
|
45
|
-
it '
|
45
|
+
it 'does not detect any problems' do
|
46
46
|
expect(problems).to have(0).problems
|
47
47
|
end
|
48
48
|
end
|
@@ -58,7 +58,7 @@ describe 'nested_classes_or_defines' do
|
|
58
58
|
END
|
59
59
|
end
|
60
60
|
|
61
|
-
it '
|
61
|
+
it 'does not detect any problems' do
|
62
62
|
expect(problems).to have(0).problems
|
63
63
|
end
|
64
64
|
end
|
@@ -73,11 +73,11 @@ describe 'nested_classes_or_defines' do
|
|
73
73
|
END
|
74
74
|
end
|
75
75
|
|
76
|
-
it '
|
76
|
+
it 'only detects a single problem' do
|
77
77
|
expect(problems).to have(1).problems
|
78
78
|
end
|
79
79
|
|
80
|
-
it '
|
80
|
+
it 'creates a warning' do
|
81
81
|
expect(problems).to contain_warning(define_msg).on_line(2).in_column(11)
|
82
82
|
end
|
83
83
|
end
|
@@ -3,11 +3,11 @@ require 'spec_helper'
|
|
3
3
|
describe 'parameter_order' do
|
4
4
|
let(:msg) { 'optional parameter listed before required parameter' }
|
5
5
|
|
6
|
-
|
6
|
+
['define', 'class'].each do |type|
|
7
7
|
context "#{type} with attrs in order" do
|
8
8
|
let(:code) { "#{type} foo($bar, $baz='gronk') { }" }
|
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
|
@@ -15,7 +15,7 @@ describe 'parameter_order' do
|
|
15
15
|
context "#{type} with parameter that calls a function" do
|
16
16
|
let(:code) { "#{type} foo($bar=extlookup($name)) {}" }
|
17
17
|
|
18
|
-
it '
|
18
|
+
it 'does not detect any problems' do
|
19
19
|
expect(problems).to have(0).problems
|
20
20
|
end
|
21
21
|
end
|
@@ -23,12 +23,12 @@ describe 'parameter_order' do
|
|
23
23
|
context "#{type} with attrs out of order" do
|
24
24
|
let(:code) { "#{type} foo($bar='baz', $gronk) { }" }
|
25
25
|
|
26
|
-
it '
|
26
|
+
it 'only detects a single problem' do
|
27
27
|
expect(problems).to have(1).problem
|
28
28
|
end
|
29
29
|
|
30
30
|
col = (type == 'class' ? 23 : 24)
|
31
|
-
it '
|
31
|
+
it 'creates a warning' do
|
32
32
|
expect(problems).to contain_warning(msg).on_line(1).in_column(col)
|
33
33
|
end
|
34
34
|
end
|
@@ -41,7 +41,7 @@ describe 'parameter_order' do
|
|
41
41
|
END
|
42
42
|
end
|
43
43
|
|
44
|
-
it '
|
44
|
+
it 'does not detect any problems' do
|
45
45
|
expect(problems).to have(0).problems
|
46
46
|
end
|
47
47
|
end
|
@@ -54,12 +54,12 @@ describe 'parameter_order' do
|
|
54
54
|
END
|
55
55
|
end
|
56
56
|
|
57
|
-
it '
|
57
|
+
it 'only detects a single problem' do
|
58
58
|
expect(problems).to have(1).problem
|
59
59
|
end
|
60
60
|
|
61
61
|
col = (type == 'class' ? 35 : 36)
|
62
|
-
it '
|
62
|
+
it 'creates a warning' do
|
63
63
|
expect(problems).to contain_warning(msg).on_line(1).in_column(col)
|
64
64
|
end
|
65
65
|
end
|
@@ -75,7 +75,7 @@ describe 'parameter_order' do
|
|
75
75
|
END
|
76
76
|
end
|
77
77
|
|
78
|
-
it '
|
78
|
+
it 'does not detect any problems' do
|
79
79
|
expect(problems).to have(0).problems
|
80
80
|
end
|
81
81
|
end
|
data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/right_to_left_relationship_spec.rb
RENAMED
@@ -6,7 +6,7 @@ describe 'right_to_left_relationship' do
|
|
6
6
|
context 'chain 2 resources left to right' do
|
7
7
|
let(:code) { 'Class[foo] -> Class[bar]' }
|
8
8
|
|
9
|
-
it '
|
9
|
+
it 'does not detect any problems' do
|
10
10
|
expect(problems).to have(0).problems
|
11
11
|
end
|
12
12
|
end
|
@@ -14,11 +14,11 @@ describe 'right_to_left_relationship' do
|
|
14
14
|
context 'chain 2 resources right to left' do
|
15
15
|
let(:code) { 'Class[foo] <- Class[bar]' }
|
16
16
|
|
17
|
-
it '
|
17
|
+
it 'only detects a single problem' do
|
18
18
|
expect(problems).to have(1).problem
|
19
19
|
end
|
20
20
|
|
21
|
-
it '
|
21
|
+
it 'creates a warning' do
|
22
22
|
expect(problems).to contain_warning(msg).on_line(1).in_column(12)
|
23
23
|
end
|
24
24
|
end
|