puppet-lint 2.5.2 → 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 +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
@@ -7,11 +7,11 @@ describe 'quoted_booleans' do
|
|
7
7
|
context 'quoted false' do
|
8
8
|
let(:code) { "class { 'foo': boolFlag => 'false' }" }
|
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(28)
|
16
16
|
end
|
17
17
|
end
|
@@ -19,11 +19,11 @@ describe 'quoted_booleans' do
|
|
19
19
|
context 'quoted true' do
|
20
20
|
let(:code) { "class { 'foo': boolFlag => 'true' }" }
|
21
21
|
|
22
|
-
it '
|
22
|
+
it 'only detects a single problem' do
|
23
23
|
expect(problems).to have(1).problem
|
24
24
|
end
|
25
25
|
|
26
|
-
it '
|
26
|
+
it 'creates a warning' do
|
27
27
|
expect(problems).to contain_warning(msg).on_line(1).in_column(28)
|
28
28
|
end
|
29
29
|
end
|
@@ -31,11 +31,11 @@ describe 'quoted_booleans' do
|
|
31
31
|
context 'double quoted true' do
|
32
32
|
let(:code) { "class { 'foo': boolFlag => \"true\" }" }
|
33
33
|
|
34
|
-
it '
|
34
|
+
it 'only detects a single problem' do
|
35
35
|
expect(problems).to have(1).problem
|
36
36
|
end
|
37
37
|
|
38
|
-
it '
|
38
|
+
it 'creates a warning' do
|
39
39
|
expect(problems).to contain_warning(msg).on_line(1).in_column(28)
|
40
40
|
end
|
41
41
|
end
|
@@ -43,37 +43,37 @@ describe 'quoted_booleans' do
|
|
43
43
|
context 'double quoted false' do
|
44
44
|
let(:code) { "class { 'foo': boolFlag => \"false\" }" }
|
45
45
|
|
46
|
-
it '
|
46
|
+
it 'only detects a single problem' do
|
47
47
|
expect(problems).to have(1).problem
|
48
48
|
end
|
49
49
|
|
50
|
-
it '
|
50
|
+
it 'creates a warning' do
|
51
51
|
expect(problems).to contain_warning(msg).on_line(1).in_column(28)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
context 'with fix enabled' do
|
57
|
-
before do
|
57
|
+
before(:each) do
|
58
58
|
PuppetLint.configuration.fix = true
|
59
59
|
end
|
60
60
|
|
61
|
-
after do
|
61
|
+
after(:each) do
|
62
62
|
PuppetLint.configuration.fix = false
|
63
63
|
end
|
64
64
|
|
65
65
|
context 'quoted false' do
|
66
66
|
let(:code) { "class { 'foo': boolFlag => 'false' }" }
|
67
67
|
|
68
|
-
it '
|
68
|
+
it 'only detects a single problem' do
|
69
69
|
expect(problems).to have(1).problem
|
70
70
|
end
|
71
71
|
|
72
|
-
it '
|
72
|
+
it 'fixes the manifest' do
|
73
73
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(28)
|
74
74
|
end
|
75
75
|
|
76
|
-
it '
|
76
|
+
it 'unquotes the boolean' do
|
77
77
|
expect(manifest).to eq("class { 'foo': boolFlag => false }")
|
78
78
|
end
|
79
79
|
end
|
@@ -81,15 +81,15 @@ describe 'quoted_booleans' do
|
|
81
81
|
context 'quoted true' do
|
82
82
|
let(:code) { "class { 'foo': boolFlag => 'true' }" }
|
83
83
|
|
84
|
-
it '
|
84
|
+
it 'only detects a single problem' do
|
85
85
|
expect(problems).to have(1).problem
|
86
86
|
end
|
87
87
|
|
88
|
-
it '
|
88
|
+
it 'fixes the manifest' do
|
89
89
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(28)
|
90
90
|
end
|
91
91
|
|
92
|
-
it '
|
92
|
+
it 'unquotes the boolean' do
|
93
93
|
expect(manifest).to eq("class { 'foo': boolFlag => true }")
|
94
94
|
end
|
95
95
|
end
|
@@ -97,15 +97,15 @@ describe 'quoted_booleans' do
|
|
97
97
|
context 'double quoted true' do
|
98
98
|
let(:code) { "class { 'foo': boolFlag => \"true\" }" }
|
99
99
|
|
100
|
-
it '
|
100
|
+
it 'only detects a single problem' do
|
101
101
|
expect(problems).to have(1).problem
|
102
102
|
end
|
103
103
|
|
104
|
-
it '
|
104
|
+
it 'fixes the manifest' do
|
105
105
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(28)
|
106
106
|
end
|
107
107
|
|
108
|
-
it '
|
108
|
+
it 'unquotes the boolean' do
|
109
109
|
expect(manifest).to eq("class { 'foo': boolFlag => true }")
|
110
110
|
end
|
111
111
|
end
|
@@ -113,15 +113,15 @@ describe 'quoted_booleans' do
|
|
113
113
|
context 'double quoted false' do
|
114
114
|
let(:code) { "class { 'foo': boolFlag => \"false\" }" }
|
115
115
|
|
116
|
-
it '
|
116
|
+
it 'only detects a single problem' do
|
117
117
|
expect(problems).to have(1).problem
|
118
118
|
end
|
119
119
|
|
120
|
-
it '
|
120
|
+
it 'fixes the manifest' do
|
121
121
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(28)
|
122
122
|
end
|
123
123
|
|
124
|
-
it '
|
124
|
+
it 'unquotes the boolean' do
|
125
125
|
expect(manifest).to eq("class { 'foo': boolFlag => false }")
|
126
126
|
end
|
127
127
|
end
|
@@ -6,11 +6,11 @@ describe 'single_quote_string_with_variables' do
|
|
6
6
|
context 'multiple strings in a line' do
|
7
7
|
let(:code) { "\"aoeu\" '${foo}'" }
|
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(msg).on_line(1).in_column(8)
|
15
15
|
end
|
16
16
|
end
|
data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/variables_not_enclosed_spec.rb
RENAMED
@@ -7,11 +7,11 @@ describe 'variables_not_enclosed' do
|
|
7
7
|
context 'variable not enclosed in {}' do
|
8
8
|
let(:code) { '" $gronk"' }
|
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(3)
|
16
16
|
end
|
17
17
|
end
|
@@ -19,37 +19,37 @@ describe 'variables_not_enclosed' do
|
|
19
19
|
context 'variable not enclosed in {} after many tokens' do
|
20
20
|
let(:code) { ("'groovy'\n" * 20) + '" $gronk"' }
|
21
21
|
|
22
|
-
it '
|
22
|
+
it 'only detects a single problem' do
|
23
23
|
expect(problems).to have(1).problem
|
24
24
|
end
|
25
25
|
|
26
|
-
it '
|
26
|
+
it 'creates a warning' do
|
27
27
|
expect(problems).to contain_warning(msg).on_line(21).in_column(3)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
context 'with fix enabled' do
|
33
|
-
before do
|
33
|
+
before(:each) do
|
34
34
|
PuppetLint.configuration.fix = true
|
35
35
|
end
|
36
36
|
|
37
|
-
after do
|
37
|
+
after(:each) do
|
38
38
|
PuppetLint.configuration.fix = false
|
39
39
|
end
|
40
40
|
|
41
41
|
context 'variable not enclosed in {}' do
|
42
42
|
let(:code) { '" $gronk"' }
|
43
43
|
|
44
|
-
it '
|
44
|
+
it 'only detects a single problem' do
|
45
45
|
expect(problems).to have(1).problem
|
46
46
|
end
|
47
47
|
|
48
|
-
it '
|
48
|
+
it 'fixes the manifest' do
|
49
49
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(3)
|
50
50
|
end
|
51
51
|
|
52
|
-
it '
|
52
|
+
it 'encloses the variable in braces' do
|
53
53
|
expect(manifest).to eq('" ${gronk}"')
|
54
54
|
end
|
55
55
|
end
|
@@ -57,15 +57,15 @@ describe 'variables_not_enclosed' do
|
|
57
57
|
context 'variable not enclosed in {} after many tokens' do
|
58
58
|
let(:code) { ("'groovy'\n" * 20) + '" $gronk"' }
|
59
59
|
|
60
|
-
it '
|
60
|
+
it 'only detects a single problem' do
|
61
61
|
expect(problems).to have(1).problem
|
62
62
|
end
|
63
63
|
|
64
|
-
it '
|
64
|
+
it 'fixes the manifest' do
|
65
65
|
expect(problems).to contain_fixed(msg).on_line(21).in_column(3)
|
66
66
|
end
|
67
67
|
|
68
|
-
it '
|
68
|
+
it 'encloses the variable in braces' do
|
69
69
|
expect(manifest).to eq(("'groovy'\n" * 20) + '" ${gronk}"')
|
70
70
|
end
|
71
71
|
end
|
@@ -73,16 +73,16 @@ describe 'variables_not_enclosed' do
|
|
73
73
|
context 'variables not enclosed in {}, delimited by -' do
|
74
74
|
let(:code) { '"$foo-$bar"' }
|
75
75
|
|
76
|
-
it '
|
76
|
+
it 'only detects two problems' do
|
77
77
|
expect(problems).to have(2).problems
|
78
78
|
end
|
79
79
|
|
80
|
-
it '
|
80
|
+
it 'fixes the manifest' do
|
81
81
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(2)
|
82
82
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(7)
|
83
83
|
end
|
84
84
|
|
85
|
-
it '
|
85
|
+
it 'encloses both variables in braces' do
|
86
86
|
expect(manifest).to eq('"${foo}-${bar}"')
|
87
87
|
end
|
88
88
|
end
|
@@ -90,15 +90,15 @@ describe 'variables_not_enclosed' do
|
|
90
90
|
context 'variable with a hash or array reference not enclosed' do
|
91
91
|
let(:code) { %("$foo['bar'][2]something") }
|
92
92
|
|
93
|
-
it '
|
93
|
+
it 'only detects a single problem' do
|
94
94
|
expect(problems).to have(1).problem
|
95
95
|
end
|
96
96
|
|
97
|
-
it '
|
97
|
+
it 'fixes the manifest' do
|
98
98
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(2)
|
99
99
|
end
|
100
100
|
|
101
|
-
it '
|
101
|
+
it 'encloses the variable with the references' do
|
102
102
|
expect(manifest).to eq(%("${foo['bar'][2]}something"))
|
103
103
|
end
|
104
104
|
end
|
@@ -106,15 +106,15 @@ describe 'variables_not_enclosed' do
|
|
106
106
|
context 'unenclosed variable followed by a dash and then text' do
|
107
107
|
let(:code) { '"$hostname-keystore"' }
|
108
108
|
|
109
|
-
it '
|
109
|
+
it 'only detects a single problem' do
|
110
110
|
expect(problems).to have(1).problem
|
111
111
|
end
|
112
112
|
|
113
|
-
it '
|
113
|
+
it 'fixes the manifest' do
|
114
114
|
expect(problems).to contain_fixed(msg).on_line(1).in_column(2)
|
115
115
|
end
|
116
116
|
|
117
|
-
it '
|
117
|
+
it 'encloses the variable but not the text' do
|
118
118
|
expect(manifest).to eq('"${hostname}-keystore"')
|
119
119
|
end
|
120
120
|
end
|
data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_variables/variable_contains_dash_spec.rb
RENAMED
@@ -6,11 +6,11 @@ describe 'variable_contains_dash' do
|
|
6
6
|
context 'a variable containing a dash' do
|
7
7
|
let(:code) { '$foo-bar' }
|
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 a warning' do
|
14
14
|
expect(problems).to contain_warning(msg).on_line(1).in_column(1)
|
15
15
|
end
|
16
16
|
end
|
@@ -18,11 +18,11 @@ describe 'variable_contains_dash' do
|
|
18
18
|
context 'variable containing a dash' do
|
19
19
|
let(:code) { '" $foo-bar"' }
|
20
20
|
|
21
|
-
it '
|
21
|
+
it 'only detects a single problem' do
|
22
22
|
expect(problems).to have(1).problem
|
23
23
|
end
|
24
24
|
|
25
|
-
it '
|
25
|
+
it 'creates a warning' do
|
26
26
|
expect(problems).to contain_warning(msg).on_line(1).in_column(3)
|
27
27
|
end
|
28
28
|
end
|
@@ -30,7 +30,7 @@ describe 'variable_contains_dash' do
|
|
30
30
|
context 'variable with an array reference containing a dash' do
|
31
31
|
let(:code) { '$foo[bar-baz]' }
|
32
32
|
|
33
|
-
it '
|
33
|
+
it 'does not detect any problems' do
|
34
34
|
expect(problems).to be_empty
|
35
35
|
end
|
36
36
|
end
|
@@ -38,7 +38,7 @@ describe 'variable_contains_dash' do
|
|
38
38
|
context 'enclosed variable in a string followed by a dash' do
|
39
39
|
let(:code) { '"${variable}-is-ok"' }
|
40
40
|
|
41
|
-
it '
|
41
|
+
it 'does not detect any problems' do
|
42
42
|
expect(problems).to be_empty
|
43
43
|
end
|
44
44
|
end
|
data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_variables/variable_is_lowercase_spec.rb
RENAMED
@@ -6,11 +6,11 @@ describe 'variable_is_lowercase' do
|
|
6
6
|
context 'a variable containing an uppercase letter' do
|
7
7
|
let(:code) { '$fooBar' }
|
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 a warning' do
|
14
14
|
expect(problems).to contain_warning(msg).on_line(1).in_column(1)
|
15
15
|
end
|
16
16
|
end
|
@@ -18,7 +18,7 @@ describe 'variable_is_lowercase' do
|
|
18
18
|
context 'a variable containing only lowercase letters' do
|
19
19
|
let(:code) { '$foobar' }
|
20
20
|
|
21
|
-
it '
|
21
|
+
it 'does not detect any problems' do
|
22
22
|
expect(problems).to have(0).problems
|
23
23
|
end
|
24
24
|
end
|
@@ -26,7 +26,7 @@ describe 'variable_is_lowercase' do
|
|
26
26
|
context 'when typecasting inside an interpolation' do
|
27
27
|
let(:code) { %("${Integer(fact('memory.system.total_bytes'))}") }
|
28
28
|
|
29
|
-
it '
|
29
|
+
it 'does not detect any problems' do
|
30
30
|
expect(problems).to have(0).problems
|
31
31
|
end
|
32
32
|
end
|
@@ -34,11 +34,11 @@ describe 'variable_is_lowercase' do
|
|
34
34
|
context 'when an interpolated variable contains an uppercase letter' do
|
35
35
|
let(:code) { '"${fooBar}"' }
|
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 a warning' do
|
42
42
|
expect(problems).to contain_warning(msg).on_line(1).in_column(4)
|
43
43
|
end
|
44
44
|
end
|
@@ -46,7 +46,7 @@ describe 'variable_is_lowercase' do
|
|
46
46
|
context 'when an interpolated variable only contains lowercase letters' do
|
47
47
|
let(:code) { '"${foobar}"' }
|
48
48
|
|
49
|
-
it '
|
49
|
+
it 'does not detect any problems' do
|
50
50
|
expect(problems).to have(0).problems
|
51
51
|
end
|
52
52
|
end
|
@@ -14,7 +14,7 @@ describe '140chars' 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,7 +28,7 @@ describe '140chars' do
|
|
28
28
|
END
|
29
29
|
end
|
30
30
|
|
31
|
-
it '
|
31
|
+
it 'does not detect any problems' do
|
32
32
|
expect(problems).to have(0).problems
|
33
33
|
end
|
34
34
|
end
|
@@ -42,7 +42,7 @@ describe '140chars' 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
|
@@ -50,11 +50,11 @@ describe '140chars' do
|
|
50
50
|
context '141 character line' do
|
51
51
|
let(:code) { 'a' * 141 }
|
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(msg).on_line(1).in_column(140)
|
59
59
|
end
|
60
60
|
end
|
@@ -12,11 +12,11 @@ describe '2sp_soft_tabs' 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 an error' do
|
20
20
|
expect(problems).to contain_error(msg).on_line(2).in_column(1)
|
21
21
|
end
|
22
22
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe '80chars' do
|
6
|
-
before do
|
6
|
+
before(:each) do
|
7
7
|
PuppetLint.configuration.send('enable_80chars')
|
8
8
|
end
|
9
9
|
|
@@ -18,7 +18,7 @@ describe '80chars' do
|
|
18
18
|
END
|
19
19
|
end
|
20
20
|
|
21
|
-
it '
|
21
|
+
it 'does not detect any problems' do
|
22
22
|
expect(problems).to have(0).problems
|
23
23
|
end
|
24
24
|
end
|
@@ -32,7 +32,7 @@ describe '80chars' 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
|
@@ -46,7 +46,7 @@ describe '80chars' do
|
|
46
46
|
END
|
47
47
|
end
|
48
48
|
|
49
|
-
it '
|
49
|
+
it 'does not detect any problems' do
|
50
50
|
expect(problems).to have(0).problems
|
51
51
|
end
|
52
52
|
end
|
@@ -54,11 +54,11 @@ describe '80chars' do
|
|
54
54
|
context '81 character line' do
|
55
55
|
let(:code) { 'a' * 81 }
|
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
|
-
it '
|
61
|
+
it 'creates a warning' do
|
62
62
|
expect(problems).to contain_warning(msg).on_line(1).in_column(80)
|
63
63
|
end
|
64
64
|
end
|