puppet-lint 0.4.0.pre1 → 1.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.
- data/.travis.yml +3 -4
- data/Gemfile +2 -5
- data/README.md +2 -149
- data/Rakefile +0 -5
- data/lib/puppet-lint.rb +74 -20
- data/lib/puppet-lint/bin.rb +20 -85
- data/lib/puppet-lint/checkplugin.rb +158 -12
- data/lib/puppet-lint/checks.rb +39 -222
- data/lib/puppet-lint/configuration.rb +12 -31
- data/lib/puppet-lint/data.rb +329 -0
- data/lib/puppet-lint/lexer.rb +37 -30
- data/lib/puppet-lint/lexer/token.rb +14 -16
- data/lib/puppet-lint/monkeypatches/string_prepend.rb +6 -0
- data/lib/puppet-lint/optparser.rb +105 -0
- data/lib/puppet-lint/plugins.rb +28 -9
- data/lib/puppet-lint/plugins/check_classes.rb +162 -238
- data/lib/puppet-lint/plugins/check_comments.rb +40 -25
- data/lib/puppet-lint/plugins/check_conditionals.rb +16 -20
- data/lib/puppet-lint/plugins/check_documentation.rb +14 -20
- data/lib/puppet-lint/plugins/check_nodes.rb +23 -0
- data/lib/puppet-lint/plugins/check_resources.rb +127 -141
- data/lib/puppet-lint/plugins/check_strings.rb +133 -107
- data/lib/puppet-lint/plugins/check_variables.rb +11 -11
- data/lib/puppet-lint/plugins/check_whitespace.rb +86 -92
- data/lib/puppet-lint/tasks/puppet-lint.rb +17 -1
- data/lib/puppet-lint/version.rb +1 -1
- data/puppet-lint.gemspec +4 -2
- data/spec/fixtures/test/manifests/ignore.pp +1 -0
- data/spec/fixtures/test/manifests/ignore_reason.pp +1 -0
- data/spec/puppet-lint/bin_spec.rb +104 -84
- data/spec/puppet-lint/configuration_spec.rb +19 -19
- data/spec/puppet-lint/ignore_overrides_spec.rb +97 -0
- data/spec/puppet-lint/lexer/token_spec.rb +9 -9
- data/spec/puppet-lint/lexer_spec.rb +352 -325
- data/spec/puppet-lint/plugins/check_classes/autoloader_layout_spec.rb +77 -23
- data/spec/puppet-lint/plugins/check_classes/class_inherits_from_params_class_spec.rb +14 -12
- data/spec/puppet-lint/plugins/check_classes/inherits_across_namespaces_spec.rb +18 -14
- data/spec/puppet-lint/plugins/check_classes/names_containing_dash_spec.rb +30 -30
- data/spec/puppet-lint/plugins/check_classes/nested_classes_or_defines_spec.rb +31 -26
- data/spec/puppet-lint/plugins/check_classes/parameter_order_spec.rb +34 -28
- data/spec/puppet-lint/plugins/check_classes/right_to_left_relationship_spec.rb +14 -12
- data/spec/puppet-lint/plugins/check_classes/variable_scope_spec.rb +74 -30
- data/spec/puppet-lint/plugins/check_comments/slash_comments_spec.rb +27 -20
- data/spec/puppet-lint/plugins/check_comments/star_comments_spec.rb +78 -13
- data/spec/puppet-lint/plugins/check_conditionals/case_without_default_spec.rb +17 -12
- data/spec/puppet-lint/plugins/check_conditionals/selector_inside_resource_spec.rb +13 -10
- data/spec/puppet-lint/plugins/check_documentation/documentation_spec.rb +21 -16
- data/spec/puppet-lint/plugins/check_nodes/unquoted_node_name_spec.rb +69 -0
- data/spec/puppet-lint/plugins/check_resources/duplicate_params_spec.rb +42 -38
- data/spec/puppet-lint/plugins/check_resources/ensure_first_param_spec.rb +22 -10
- data/spec/puppet-lint/plugins/check_resources/ensure_not_symlink_target_spec.rb +81 -18
- data/spec/puppet-lint/plugins/check_resources/file_mode_spec.rb +69 -112
- data/spec/puppet-lint/plugins/check_resources/unquoted_file_mode_spec.rb +27 -20
- data/spec/puppet-lint/plugins/check_resources/unquoted_resource_title_spec.rb +177 -171
- data/spec/puppet-lint/plugins/check_strings/double_quoted_strings_spec.rb +165 -88
- data/spec/puppet-lint/plugins/check_strings/only_variable_string_spec.rb +97 -22
- data/spec/puppet-lint/plugins/check_strings/puppet_url_without_modules_spec.rb +25 -0
- data/spec/puppet-lint/plugins/check_strings/quoted_booleans_spec.rb +97 -111
- data/spec/puppet-lint/plugins/check_strings/single_quote_string_with_variables_spec.rb +10 -9
- data/spec/puppet-lint/plugins/check_strings/variables_not_enclosed_spec.rb +53 -53
- data/spec/puppet-lint/plugins/check_variables/variable_contains_dash_spec.rb +26 -14
- data/spec/puppet-lint/plugins/check_whitespace/2sp_soft_tabs_spec.rb +10 -9
- data/spec/puppet-lint/plugins/check_whitespace/80chars_spec.rb +31 -15
- data/spec/puppet-lint/plugins/check_whitespace/arrow_alignment_spec.rb +340 -322
- data/spec/puppet-lint/plugins/check_whitespace/hard_tabs_spec.rb +30 -23
- data/spec/puppet-lint/plugins/check_whitespace/trailing_whitespace_spec.rb +42 -41
- data/spec/puppet-lint_spec.rb +3 -3
- data/spec/spec_helper.rb +109 -116
- metadata +109 -50
- data/spec/puppet-lint/plugins/check_classes/class_parameter_defaults_spec.rb +0 -60
@@ -1,20 +1,60 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'only_variable_string' do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
4
|
+
let(:msg) { 'string containing only a variable' }
|
5
|
+
|
6
|
+
context 'with fix disabled' do
|
7
|
+
context 'string containing only a variable' do
|
8
|
+
let(:code) { '"${foo}"' }
|
9
|
+
|
10
|
+
it 'should only detect a single problem' do
|
11
|
+
expect(problems).to have(1).problem
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should create a warning' do
|
15
|
+
expect(problems).to contain_warning(msg).on_line(1).in_column(3)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'string containing only a variable w/ ref' do
|
20
|
+
let(:code) { '"${foo[0]}"' }
|
21
|
+
|
22
|
+
it 'should only detect a single problem' do
|
23
|
+
expect(problems).to have(1).problem
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should create a warning' do
|
27
|
+
expect(problems).to contain_warning(msg).on_line(1).in_column(3)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'string containing only a variable w/ lots of refs' do
|
32
|
+
let(:code) { '"${foo[0][aoeuaoeu][bar][999]}"' }
|
33
|
+
|
34
|
+
it 'should only detect a single problem' do
|
35
|
+
expect(problems).to have(1).problem
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should create a warning' do
|
39
|
+
expect(problems).to contain_warning(msg).on_line(1).in_column(3)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'string containing only a variable as a hash key' do
|
44
|
+
let(:code) { "
|
45
|
+
$bar = 'key'
|
46
|
+
$foo = {
|
47
|
+
\"$bar\" => 1,
|
48
|
+
}"
|
49
|
+
}
|
50
|
+
|
51
|
+
it 'should not detect any problems' do
|
52
|
+
expect(problems).to be_empty
|
53
|
+
end
|
54
|
+
end
|
15
55
|
end
|
16
56
|
|
17
|
-
|
57
|
+
context 'with fix enabled' do
|
18
58
|
before do
|
19
59
|
PuppetLint.configuration.fix = true
|
20
60
|
end
|
@@ -23,17 +63,52 @@ describe 'only_variable_string' do
|
|
23
63
|
PuppetLint.configuration.fix = false
|
24
64
|
end
|
25
65
|
|
26
|
-
|
66
|
+
context 'string containing only a variable' do
|
67
|
+
let(:code) { '"${foo}"' }
|
68
|
+
|
69
|
+
it 'should only detect a single problem' do
|
70
|
+
expect(problems).to have(1).problem
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should fix the manifest' do
|
74
|
+
expect(problems).to contain_fixed(msg).on_line(1).in_column(3)
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'should unquote the variable' do
|
78
|
+
expect(manifest).to eq("$foo")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context 'string contaiting only a variable w/ ref' do
|
83
|
+
let(:code) { '"${foo[0]}"' }
|
84
|
+
|
85
|
+
it 'should only detect a single problem' do
|
86
|
+
expect(problems).to have(1).problem
|
87
|
+
end
|
27
88
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
:message => 'string containing only a variable',
|
32
|
-
:linenumber => 1,
|
33
|
-
:column => 3,
|
34
|
-
})
|
35
|
-
}
|
89
|
+
it 'should fix the manifest' do
|
90
|
+
expect(problems).to contain_fixed(msg).on_line(1).in_column(3)
|
91
|
+
end
|
36
92
|
|
37
|
-
|
93
|
+
it 'should unquoted the variable' do
|
94
|
+
expect(manifest).to eq("$foo[0]")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
context 'string containing only a variable w/ lots of refs' do
|
99
|
+
let(:code) { '"${foo[0][aoeuaoeu][bar][999]}"' }
|
100
|
+
|
101
|
+
it 'should only detect a single problem' do
|
102
|
+
expect(problems).to have(1).problem
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'should fix the manifest' do
|
106
|
+
expect(problems).to contain_fixed(msg).on_line(1).in_column(3)
|
107
|
+
end
|
108
|
+
|
109
|
+
it 'should unquote the variable' do
|
110
|
+
expect(manifest).to eq("$foo[0][aoeuaoeu][bar][999]")
|
111
|
+
end
|
112
|
+
end
|
38
113
|
end
|
39
114
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'puppet_url_without_modules' do
|
4
|
+
let(:msg) { 'puppet:// URL without modules/ found' }
|
5
|
+
|
6
|
+
context 'puppet:// url with modules' do
|
7
|
+
let(:code) { "'puppet:///modules/foo'" }
|
8
|
+
|
9
|
+
it 'should not detect any problems' do
|
10
|
+
expect(problems).to have(0).problems
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'puppet:// url without modules' do
|
15
|
+
let(:code) { "'puppet:///foo'" }
|
16
|
+
|
17
|
+
it 'should only detect a single problem' do
|
18
|
+
expect(problems).to have(1).problem
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should create a warning' do
|
22
|
+
expect(problems).to contain_warning(msg).on_line(1).in_column(1)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,81 +1,59 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'quoted_booleans' do
|
4
|
-
|
5
|
-
let(:code) { "class { 'foo': boolFlag => 'false' }" }
|
6
|
-
|
7
|
-
its(:problems) {
|
8
|
-
should only_have_problem({
|
9
|
-
:kind => :warning,
|
10
|
-
:message => 'quoted boolean value found',
|
11
|
-
:linenumber => 1,
|
12
|
-
:column => 28,
|
13
|
-
})
|
14
|
-
}
|
15
|
-
end
|
4
|
+
let(:msg) { 'quoted boolean value found' }
|
16
5
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
its(:problems) {
|
21
|
-
should only_have_problem({
|
22
|
-
:kind => :warning,
|
23
|
-
:message => 'quoted boolean value found',
|
24
|
-
:linenumber => 1,
|
25
|
-
:column => 28,
|
26
|
-
})
|
27
|
-
}
|
28
|
-
end
|
6
|
+
context 'with fix disabled' do
|
7
|
+
context 'quoted false' do
|
8
|
+
let(:code) { "class { 'foo': boolFlag => 'false' }" }
|
29
9
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
its(:problems) {
|
34
|
-
should have_problem({
|
35
|
-
:kind => :warning,
|
36
|
-
:message => 'quoted boolean value found',
|
37
|
-
:linenumber => 1,
|
38
|
-
:column => 28,
|
39
|
-
})
|
40
|
-
}
|
41
|
-
end
|
10
|
+
it 'should only detect a single problem' do
|
11
|
+
expect(problems).to have(1).problem
|
12
|
+
end
|
42
13
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
should have_problem({
|
48
|
-
:kind => :warning,
|
49
|
-
:message => 'quoted boolean value found',
|
50
|
-
:linenumber => 1,
|
51
|
-
:column => 28,
|
52
|
-
})
|
53
|
-
}
|
54
|
-
end
|
14
|
+
it 'should create a warning' do
|
15
|
+
expect(problems).to contain_warning(msg).on_line(1).in_column(28)
|
16
|
+
end
|
17
|
+
end
|
55
18
|
|
56
|
-
|
57
|
-
|
58
|
-
|
19
|
+
context 'quoted true' do
|
20
|
+
let(:code) { "class { 'foo': boolFlag => 'true' }" }
|
21
|
+
|
22
|
+
it 'should only detect a single problem' do
|
23
|
+
expect(problems).to have(1).problem
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should create a warning' do
|
27
|
+
expect(problems).to contain_warning(msg).on_line(1).in_column(28)
|
28
|
+
end
|
59
29
|
end
|
60
30
|
|
61
|
-
|
62
|
-
|
31
|
+
context 'double quoted true' do
|
32
|
+
let(:code) { "class { 'foo': boolFlag => \"true\" }" }
|
33
|
+
|
34
|
+
it 'should only detect a single problem' do
|
35
|
+
expect(problems).to have(1).problem
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should create a warning' do
|
39
|
+
expect(problems).to contain_warning(msg).on_line(1).in_column(28)
|
40
|
+
end
|
63
41
|
end
|
64
42
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
should
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
43
|
+
context 'double quoted false' do
|
44
|
+
let(:code) { "class { 'foo': boolFlag => \"false\" }" }
|
45
|
+
|
46
|
+
it 'should only detect a single problem' do
|
47
|
+
expect(problems).to have(1).problem
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should create a warning' do
|
51
|
+
expect(problems).to contain_warning(msg).on_line(1).in_column(28)
|
52
|
+
end
|
53
|
+
end
|
76
54
|
end
|
77
55
|
|
78
|
-
|
56
|
+
context 'with fix enabled' do
|
79
57
|
before do
|
80
58
|
PuppetLint.configuration.fix = true
|
81
59
|
end
|
@@ -84,60 +62,68 @@ describe 'quoted_booleans' do
|
|
84
62
|
PuppetLint.configuration.fix = false
|
85
63
|
end
|
86
64
|
|
87
|
-
|
88
|
-
|
89
|
-
its(:problems) {
|
90
|
-
should only_have_problem({
|
91
|
-
:kind => :fixed,
|
92
|
-
:message => 'quoted boolean value found',
|
93
|
-
:linenumber => 1,
|
94
|
-
:column => 28,
|
95
|
-
})
|
96
|
-
}
|
97
|
-
its(:manifest) { should == "class { 'foo': boolFlag => true }" }
|
98
|
-
end
|
65
|
+
context 'quoted false' do
|
66
|
+
let(:code) { "class { 'foo': boolFlag => 'false' }" }
|
99
67
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
end
|
68
|
+
it 'should only detect a single problem' do
|
69
|
+
expect(problems).to have(1).problem
|
70
|
+
end
|
104
71
|
|
105
|
-
|
106
|
-
|
72
|
+
it 'should fix the manifest' do
|
73
|
+
expect(problems).to contain_fixed(msg).on_line(1).in_column(28)
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should unquote the boolean' do
|
77
|
+
expect(manifest).to eq("class { 'foo': boolFlag => false }")
|
78
|
+
end
|
107
79
|
end
|
108
80
|
|
109
|
-
|
110
|
-
|
111
|
-
its(:problems) {
|
112
|
-
should have_problem({
|
113
|
-
:kind => :fixed,
|
114
|
-
:message => 'quoted boolean value found',
|
115
|
-
:linenumber => 1,
|
116
|
-
:column => 28,
|
117
|
-
})
|
118
|
-
}
|
119
|
-
its(:manifest) { should == "class { 'foo': boolFlag => true }" }
|
120
|
-
end
|
81
|
+
context 'quoted true' do
|
82
|
+
let(:code) { "class { 'foo': boolFlag => 'true' }" }
|
121
83
|
|
122
|
-
|
123
|
-
|
124
|
-
|
84
|
+
it 'should only detect a single problem' do
|
85
|
+
expect(problems).to have(1).problem
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'should fix the manifest' do
|
89
|
+
expect(problems).to contain_fixed(msg).on_line(1).in_column(28)
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'should unquote the boolean' do
|
93
|
+
expect(manifest).to eq("class { 'foo': boolFlag => true }")
|
94
|
+
end
|
125
95
|
end
|
126
96
|
|
127
|
-
|
128
|
-
|
97
|
+
context 'double quoted true' do
|
98
|
+
let(:code) { "class { 'foo': boolFlag => \"true\" }" }
|
99
|
+
|
100
|
+
it 'should only detect a single problem' do
|
101
|
+
expect(problems).to have(1).problem
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'should fix the manifest' do
|
105
|
+
expect(problems).to contain_fixed(msg).on_line(1).in_column(28)
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'should unquote the boolean' do
|
109
|
+
expect(manifest).to eq("class { 'foo': boolFlag => true }")
|
110
|
+
end
|
129
111
|
end
|
130
112
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
should
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
113
|
+
context 'double quoted false' do
|
114
|
+
let(:code) { "class { 'foo': boolFlag => \"false\" }" }
|
115
|
+
|
116
|
+
it 'should only detect a single problem' do
|
117
|
+
expect(problems).to have(1).problem
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'should fix the manifest' do
|
121
|
+
expect(problems).to contain_fixed(msg).on_line(1).in_column(28)
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'should unquote the boolean' do
|
125
|
+
expect(manifest).to eq("class { 'foo': boolFlag => false }")
|
126
|
+
end
|
127
|
+
end
|
142
128
|
end
|
143
129
|
end
|
@@ -1,16 +1,17 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'single_quote_string_with_variables' do
|
4
|
-
|
4
|
+
let(:msg) { 'single quoted string containing a variable found' }
|
5
|
+
|
6
|
+
context 'multiple strings in a line' do
|
5
7
|
let(:code) { "\"aoeu\" '${foo}'" }
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
}
|
9
|
+
it 'should only detect a single problem' do
|
10
|
+
expect(problems).to have(1).problem
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should create an error' do
|
14
|
+
expect(problems).to contain_error(msg).on_line(1).in_column(8)
|
15
|
+
end
|
15
16
|
end
|
16
17
|
end
|
@@ -1,55 +1,35 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'variables_not_enclosed' do
|
4
|
-
|
5
|
-
let(:code) { '" $gronk"' }
|
6
|
-
|
7
|
-
its(:problems) {
|
8
|
-
should only_have_problem({
|
9
|
-
:kind => :warning,
|
10
|
-
:message => 'variable not enclosed in {}',
|
11
|
-
:linenumber => 1,
|
12
|
-
:column => 3,
|
13
|
-
})
|
14
|
-
}
|
15
|
-
end
|
4
|
+
let(:msg) { 'variable not enclosed in {}' }
|
16
5
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
6
|
+
context 'with fix disabled' do
|
7
|
+
context 'variable not enclosed in {}' do
|
8
|
+
let(:code) { '" $gronk"' }
|
21
9
|
|
22
|
-
|
23
|
-
|
10
|
+
it 'should only detect a single problem' do
|
11
|
+
expect(problems).to have(1).problem
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should create a warning' do
|
15
|
+
expect(problems).to contain_warning(msg).on_line(1).in_column(3)
|
16
|
+
end
|
24
17
|
end
|
25
18
|
|
26
|
-
|
27
|
-
|
28
|
-
its(:problems) {
|
29
|
-
should only_have_problem({
|
30
|
-
:kind => :fixed,
|
31
|
-
:message => 'variable not enclosed in {}',
|
32
|
-
:linenumber => 1,
|
33
|
-
:column => 3,
|
34
|
-
})
|
35
|
-
}
|
36
|
-
its(:manifest) { should == '" ${gronk}"' }
|
37
|
-
end
|
19
|
+
context 'variable not enclosed in {} after many tokens' do
|
20
|
+
let(:code) { ("'groovy'\n" * 20) + '" $gronk"' }
|
38
21
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
should
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
:column => 3,
|
48
|
-
})
|
49
|
-
}
|
22
|
+
it 'should only detect a single problem' do
|
23
|
+
expect(problems).to have(1).problem
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should create a warning' do
|
27
|
+
expect(problems).to contain_warning(msg).on_line(21).in_column(3)
|
28
|
+
end
|
29
|
+
end
|
50
30
|
end
|
51
31
|
|
52
|
-
|
32
|
+
context 'with fix enabled' do
|
53
33
|
before do
|
54
34
|
PuppetLint.configuration.fix = true
|
55
35
|
end
|
@@ -58,16 +38,36 @@ describe 'variables_not_enclosed' do
|
|
58
38
|
PuppetLint.configuration.fix = false
|
59
39
|
end
|
60
40
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
should
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
41
|
+
context 'variable not enclosed in {}' do
|
42
|
+
let(:code) { '" $gronk"' }
|
43
|
+
|
44
|
+
it 'should only detect a single problem' do
|
45
|
+
expect(problems).to have(1).problem
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should fix the manifest' do
|
49
|
+
expect(problems).to contain_fixed(msg).on_line(1).in_column(3)
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should enclose the variable in braces' do
|
53
|
+
expect(manifest).to eq('" ${gronk}"')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'variable not enclosed in {} after many tokens' do
|
58
|
+
let(:code) { ("'groovy'\n" * 20) + '" $gronk"' }
|
59
|
+
|
60
|
+
it 'should only detect a single problem' do
|
61
|
+
expect(problems).to have(1).problem
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should fix the manifest' do
|
65
|
+
expect(problems).to contain_fixed(msg).on_line(21).in_column(3)
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should enclose the variable in braces' do
|
69
|
+
expect(manifest).to eq(("'groovy'\n" * 20) + '" ${gronk}"')
|
70
|
+
end
|
71
|
+
end
|
72
72
|
end
|
73
73
|
end
|