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.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +522 -0
  3. data/lib/puppet-lint/bin.rb +71 -6
  4. data/lib/puppet-lint/checkplugin.rb +43 -9
  5. data/lib/puppet-lint/checks.rb +16 -16
  6. data/lib/puppet-lint/configuration.rb +134 -134
  7. data/lib/puppet-lint/data.rb +28 -28
  8. data/lib/puppet-lint/lexer/string_slurper.rb +138 -140
  9. data/lib/puppet-lint/lexer/token.rb +188 -190
  10. data/lib/puppet-lint/lexer.rb +416 -417
  11. data/lib/puppet-lint/monkeypatches.rb +1 -1
  12. data/lib/puppet-lint/optparser.rb +5 -1
  13. data/lib/puppet-lint/plugins/check_classes/arrow_on_right_operand_line.rb +6 -4
  14. data/lib/puppet-lint/plugins/check_classes/autoloader_layout.rb +5 -3
  15. data/lib/puppet-lint/plugins/check_classes/class_inherits_from_params_class.rb +6 -4
  16. data/lib/puppet-lint/plugins/check_classes/code_on_top_scope.rb +5 -3
  17. data/lib/puppet-lint/plugins/check_classes/inherits_across_namespaces.rb +5 -3
  18. data/lib/puppet-lint/plugins/check_classes/names_containing_dash.rb +5 -3
  19. data/lib/puppet-lint/plugins/check_classes/names_containing_uppercase.rb +7 -5
  20. data/lib/puppet-lint/plugins/check_classes/nested_classes_or_defines.rb +5 -3
  21. data/lib/puppet-lint/plugins/check_classes/parameter_order.rb +7 -4
  22. data/lib/puppet-lint/plugins/check_classes/right_to_left_relationship.rb +5 -3
  23. data/lib/puppet-lint/plugins/check_classes/variable_scope.rb +15 -13
  24. data/lib/puppet-lint/plugins/check_comments/slash_comments.rb +9 -7
  25. data/lib/puppet-lint/plugins/check_comments/star_comments.rb +10 -8
  26. data/lib/puppet-lint/plugins/check_conditionals/case_without_default.rb +6 -4
  27. data/lib/puppet-lint/plugins/check_conditionals/selector_inside_resource.rb +5 -3
  28. data/lib/puppet-lint/plugins/check_documentation/documentation.rb +7 -3
  29. data/lib/puppet-lint/plugins/check_nodes/unquoted_node_name.rb +15 -11
  30. data/lib/puppet-lint/plugins/check_resources/duplicate_params.rb +5 -3
  31. data/lib/puppet-lint/plugins/check_resources/ensure_first_param.rb +8 -5
  32. data/lib/puppet-lint/plugins/check_resources/ensure_not_symlink_target.rb +11 -8
  33. data/lib/puppet-lint/plugins/check_resources/file_mode.rb +14 -9
  34. data/lib/puppet-lint/plugins/check_resources/unquoted_file_mode.rb +11 -6
  35. data/lib/puppet-lint/plugins/check_resources/unquoted_resource_title.rb +6 -4
  36. data/lib/puppet-lint/plugins/check_strings/double_quoted_strings.rb +12 -7
  37. data/lib/puppet-lint/plugins/check_strings/only_variable_string.rb +8 -6
  38. data/lib/puppet-lint/plugins/check_strings/puppet_url_without_modules.rb +14 -8
  39. data/lib/puppet-lint/plugins/check_strings/quoted_booleans.rb +11 -7
  40. data/lib/puppet-lint/plugins/check_strings/single_quote_string_with_variables.rb +11 -6
  41. data/lib/puppet-lint/plugins/check_strings/variables_not_enclosed.rb +12 -8
  42. data/lib/puppet-lint/plugins/check_variables/variable_contains_dash.rb +11 -7
  43. data/lib/puppet-lint/plugins/check_variables/variable_is_lowercase.rb +11 -7
  44. data/lib/puppet-lint/plugins/check_whitespace/140chars.rb +3 -8
  45. data/lib/puppet-lint/plugins/check_whitespace/2sp_soft_tabs.rb +10 -8
  46. data/lib/puppet-lint/plugins/check_whitespace/80chars.rb +3 -8
  47. data/lib/puppet-lint/plugins/check_whitespace/arrow_alignment.rb +10 -8
  48. data/lib/puppet-lint/plugins/check_whitespace/hard_tabs.rb +11 -7
  49. data/lib/puppet-lint/plugins/check_whitespace/line_length.rb +29 -0
  50. data/lib/puppet-lint/plugins/check_whitespace/trailing_whitespace.rb +13 -7
  51. data/lib/puppet-lint/plugins.rb +63 -61
  52. data/lib/puppet-lint/report/github.rb +17 -0
  53. data/lib/puppet-lint/report/sarif_template.json +63 -0
  54. data/lib/puppet-lint/tasks/puppet-lint.rb +84 -83
  55. data/lib/puppet-lint/tasks/release_test.rb +4 -1
  56. data/lib/puppet-lint/version.rb +1 -1
  57. data/lib/puppet-lint.rb +27 -12
  58. data/spec/acceptance/puppet_lint_spec.rb +46 -0
  59. data/spec/spec_helper.rb +92 -91
  60. data/spec/spec_helper_acceptance.rb +6 -0
  61. data/spec/spec_helper_acceptance_local.rb +38 -0
  62. data/spec/{puppet-lint → unit/puppet-lint}/bin_spec.rb +79 -35
  63. data/spec/{puppet-lint → unit/puppet-lint}/checks_spec.rb +36 -36
  64. data/spec/unit/puppet-lint/configuration_spec.rb +88 -0
  65. data/spec/{puppet-lint → unit/puppet-lint}/data_spec.rb +6 -3
  66. data/spec/{puppet-lint → unit/puppet-lint}/ignore_overrides_spec.rb +17 -17
  67. data/spec/{puppet-lint → unit/puppet-lint}/lexer/string_slurper_spec.rb +128 -128
  68. data/spec/{puppet-lint → unit/puppet-lint}/lexer/token_spec.rb +1 -1
  69. data/spec/{puppet-lint → unit/puppet-lint}/lexer_spec.rb +653 -671
  70. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/arrow_on_right_operand_line_spec.rb +16 -16
  71. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/autoloader_layout_spec.rb +13 -13
  72. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/class_inherits_from_params_class_spec.rb +3 -3
  73. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/code_on_top_scope_spec.rb +4 -4
  74. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/inherits_across_namespaces_spec.rb +4 -4
  75. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/name_contains_uppercase_spec.rb +10 -10
  76. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/names_containing_dash_spec.rb +7 -7
  77. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/nested_classes_or_defines_spec.rb +7 -7
  78. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/parameter_order_spec.rb +9 -9
  79. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/right_to_left_relationship_spec.rb +3 -3
  80. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/variable_scope_spec.rb +25 -25
  81. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_comments/slash_comments_spec.rb +7 -7
  82. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_comments/star_comments_spec.rb +13 -13
  83. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_conditionals/case_without_default_spec.rb +10 -10
  84. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_conditionals/selector_inside_resource_spec.rb +3 -3
  85. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_documentation/documentation_spec.rb +8 -8
  86. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_nodes/unquoted_node_name_spec.rb +24 -24
  87. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/duplicate_params_spec.rb +9 -9
  88. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/ensure_first_param_spec.rb +19 -19
  89. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/ensure_not_symlink_target_spec.rb +10 -10
  90. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/file_mode_spec.rb +40 -40
  91. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/unquoted_file_mode_spec.rb +20 -20
  92. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/unquoted_resource_title_spec.rb +24 -24
  93. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/double_quoted_strings_spec.rb +28 -27
  94. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/only_variable_string_spec.rb +18 -18
  95. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/puppet_url_without_modules_spec.rb +9 -9
  96. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/quoted_booleans_spec.rb +22 -22
  97. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/single_quote_string_with_variables_spec.rb +2 -2
  98. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/variables_not_enclosed_spec.rb +21 -21
  99. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_variables/variable_contains_dash_spec.rb +6 -6
  100. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_variables/variable_is_lowercase_spec.rb +7 -7
  101. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_whitespace/140chars_spec.rb +5 -5
  102. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_whitespace/2sp_soft_tabs_spec.rb +2 -2
  103. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_whitespace/80chars_spec.rb +6 -6
  104. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_whitespace/arrow_alignment_spec.rb +127 -127
  105. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_whitespace/hard_tabs_spec.rb +7 -7
  106. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_whitespace/trailing_whitespace_spec.rb +15 -15
  107. data/spec/unit/puppet-lint/puppet-lint_spec.rb +18 -0
  108. metadata +69 -120
  109. data/CHANGELOG.md +0 -1130
  110. data/spec/puppet-lint/configuration_spec.rb +0 -66
  111. data/spec/puppet-lint_spec.rb +0 -16
@@ -7,11 +7,11 @@ describe 'unquoted_file_mode' do
7
7
  context '4 digit unquoted file mode' do
8
8
  let(:code) { "file { 'foo': mode => 0777 }" }
9
9
 
10
- it 'should only detect a single problem' do
10
+ it 'only detects a single problem' do
11
11
  expect(problems).to have(1).problem
12
12
  end
13
13
 
14
- it 'should create a warning' do
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,11 +19,11 @@ describe 'unquoted_file_mode' do
19
19
  context '4 digit unquoted file mode' do
20
20
  let(:code) { "concat { 'foo': mode => 0777 }" }
21
21
 
22
- it 'should only detect a single problem' do
22
+ it 'only detects a single problem' do
23
23
  expect(problems).to have(1).problem
24
24
  end
25
25
 
26
- it 'should create a warning' do
26
+ it 'creates a warning' do
27
27
  expect(problems).to contain_warning(msg).on_line(1).in_column(25)
28
28
  end
29
29
  end
@@ -31,7 +31,7 @@ describe 'unquoted_file_mode' do
31
31
  context 'file mode from a function rvalue' do
32
32
  let(:code) { "file { 'foo': mode => lookup('bar'), }" }
33
33
 
34
- it 'should not detect any problems' do
34
+ it 'does not detect any problems' do
35
35
  expect(problems).to have(0).problems
36
36
  end
37
37
  end
@@ -51,11 +51,11 @@ describe 'unquoted_file_mode' do
51
51
  END
52
52
  end
53
53
 
54
- it 'should detect 3 problems' do
54
+ it 'detects 3 problems' do
55
55
  expect(problems).to have(3).problems
56
56
  end
57
57
 
58
- it 'should create three warnings' do
58
+ it 'creates three warnings' do
59
59
  expect(problems).to contain_warning(sprintf(msg)).on_line(4).in_column(23)
60
60
  expect(problems).to contain_warning(sprintf(msg)).on_line(6).in_column(23)
61
61
  expect(problems).to contain_warning(sprintf(msg)).on_line(8).in_column(23)
@@ -64,26 +64,26 @@ describe 'unquoted_file_mode' do
64
64
  end
65
65
 
66
66
  context 'with fix enabled' do
67
- before do
67
+ before(:each) do
68
68
  PuppetLint.configuration.fix = true
69
69
  end
70
70
 
71
- after do
71
+ after(:each) do
72
72
  PuppetLint.configuration.fix = false
73
73
  end
74
74
 
75
75
  context '4 digit unquoted file mode w/fix' do
76
76
  let(:code) { "file { 'foo': mode => 0777 }" }
77
77
 
78
- it 'should only detect a single problem' do
78
+ it 'only detects a single problem' do
79
79
  expect(problems).to have(1).problem
80
80
  end
81
81
 
82
- it 'should fix the manifest' do
82
+ it 'fixes the manifest' do
83
83
  expect(problems).to contain_fixed(msg).on_line(1).in_column(23)
84
84
  end
85
85
 
86
- it 'should single quote the file mode' do
86
+ it 'single quotes the file mode' do
87
87
  expect(manifest).to eq("file { 'foo': mode => '0777' }")
88
88
  end
89
89
  end
@@ -91,15 +91,15 @@ describe 'unquoted_file_mode' do
91
91
  context '4 digit unquoted file mode w/fix' do
92
92
  let(:code) { "concat { 'foo': mode => 0777 }" }
93
93
 
94
- it 'should only detect a single problem' do
94
+ it 'only detects a single problem' do
95
95
  expect(problems).to have(1).problem
96
96
  end
97
97
 
98
- it 'should fix the manifest' do
98
+ it 'fixes the manifest' do
99
99
  expect(problems).to contain_fixed(msg).on_line(1).in_column(25)
100
100
  end
101
101
 
102
- it 'should single quote the file mode' do
102
+ it 'single quotes the file mode' do
103
103
  expect(manifest).to eq("concat { 'foo': mode => '0777' }")
104
104
  end
105
105
  end
@@ -107,11 +107,11 @@ describe 'unquoted_file_mode' do
107
107
  context 'file mode from a function rvalue' do
108
108
  let(:code) { "file { 'foo': mode => lookup('bar'), }" }
109
109
 
110
- it 'should not detect any problems' do
110
+ it 'does not detect any problems' do
111
111
  expect(problems).to have(0).problems
112
112
  end
113
113
 
114
- it 'should not change the manifest' do
114
+ it 'does not change the manifest' do
115
115
  expect(manifest).to eq(code)
116
116
  end
117
117
  end
@@ -145,17 +145,17 @@ describe 'unquoted_file_mode' do
145
145
  END
146
146
  end
147
147
 
148
- it 'should detect 3 problems' do
148
+ it 'detects 3 problems' do
149
149
  expect(problems).to have(3).problems
150
150
  end
151
151
 
152
- it 'should fix 3 problems' do
152
+ it 'fixes 3 problems' do
153
153
  expect(problems).to contain_fixed(msg).on_line(4).in_column(23)
154
154
  expect(problems).to contain_fixed(msg).on_line(6).in_column(23)
155
155
  expect(problems).to contain_fixed(msg).on_line(8).in_column(23)
156
156
  end
157
157
 
158
- it 'should quote the file modes' do
158
+ it 'quotes the file modes' do
159
159
  expect(manifest).to eq(fixed)
160
160
  end
161
161
  end
@@ -7,7 +7,7 @@ describe 'unquoted_resource_title' do
7
7
  context 'quoted resource title on single line resource' do
8
8
  let(:code) { "file { 'foo': }" }
9
9
 
10
- it 'should not detect any problems' do
10
+ it 'does not detect any problems' do
11
11
  expect(problems).to have(0).problems
12
12
  end
13
13
  end
@@ -15,11 +15,11 @@ describe 'unquoted_resource_title' do
15
15
  context 'unquoted resource title on single line resource' do
16
16
  let(:code) { 'file { foo: }' }
17
17
 
18
- it 'should only detect a single problem' do
18
+ it 'only detects a single problem' do
19
19
  expect(problems).to have(1).problem
20
20
  end
21
21
 
22
- it 'should create a warning' do
22
+ it 'creates a warning' do
23
23
  expect(problems).to contain_warning(msg).on_line(1).in_column(8)
24
24
  end
25
25
  end
@@ -32,7 +32,7 @@ describe 'unquoted_resource_title' do
32
32
  END
33
33
  end
34
34
 
35
- it 'should not detect any problems' do
35
+ it 'does not detect any problems' do
36
36
  expect(problems).to have(0).problems
37
37
  end
38
38
  end
@@ -45,11 +45,11 @@ describe 'unquoted_resource_title' do
45
45
  END
46
46
  end
47
47
 
48
- it 'should only detect a single problem' do
48
+ it 'only detects a single problem' do
49
49
  expect(problems).to have(1).problem
50
50
  end
51
51
 
52
- it 'should create a warning' do
52
+ it 'creates a warning' do
53
53
  expect(problems).to contain_warning(msg).on_line(1).in_column(18)
54
54
  end
55
55
  end
@@ -64,7 +64,7 @@ describe 'unquoted_resource_title' do
64
64
  END
65
65
  end
66
66
 
67
- it 'should not detect any problems' do
67
+ it 'does not detect any problems' do
68
68
  expect(problems).to have(0).problems
69
69
  end
70
70
  end
@@ -79,11 +79,11 @@ describe 'unquoted_resource_title' do
79
79
  END
80
80
  end
81
81
 
82
- it 'should only detect a single problem' do
82
+ it 'only detects a single problem' do
83
83
  expect(problems).to have(1).problem
84
84
  end
85
85
 
86
- it 'should create a warning' do
86
+ it 'creates a warning' do
87
87
  expect(problems).to contain_warning(msg).on_line(3).in_column(13)
88
88
  end
89
89
  end
@@ -91,7 +91,7 @@ describe 'unquoted_resource_title' do
91
91
  context 'single line resource with an array of titles (all quoted)' do
92
92
  let(:code) { "file { ['foo', 'bar']: }" }
93
93
 
94
- it 'should not detect any problems' do
94
+ it 'does not detect any problems' do
95
95
  expect(problems).to have(0).problems
96
96
  end
97
97
  end
@@ -109,7 +109,7 @@ describe 'unquoted_resource_title' do
109
109
  END
110
110
  end
111
111
 
112
- it 'should not detect any problems' do
112
+ it 'does not detect any problems' do
113
113
  expect(problems).to have(0).problems
114
114
  end
115
115
  end
@@ -124,7 +124,7 @@ describe 'unquoted_resource_title' do
124
124
  END
125
125
  end
126
126
 
127
- it 'should not detect any problems' do
127
+ it 'does not detect any problems' do
128
128
  expect(problems).to have(0).problems
129
129
  end
130
130
  end
@@ -146,33 +146,33 @@ describe 'unquoted_resource_title' do
146
146
  END
147
147
  end
148
148
 
149
- it 'should not detect any problems' do
149
+ it 'does not detect any problems' do
150
150
  expect(problems).to have(0).problems
151
151
  end
152
152
  end
153
153
  end
154
154
 
155
155
  context 'with fix enabled' do
156
- before do
156
+ before(:each) do
157
157
  PuppetLint.configuration.fix = true
158
158
  end
159
159
 
160
- after do
160
+ after(:each) do
161
161
  PuppetLint.configuration.fix = false
162
162
  end
163
163
 
164
164
  context 'unquoted resource title on single line resource' do
165
165
  let(:code) { 'file { foo: }' }
166
166
 
167
- it 'should only detect a single problem' do
167
+ it 'only detects a single problem' do
168
168
  expect(problems).to have(1).problem
169
169
  end
170
170
 
171
- it 'should fix the manifest' do
171
+ it 'fixes the manifest' do
172
172
  expect(problems).to contain_fixed(msg).on_line(1).in_column(8)
173
173
  end
174
174
 
175
- it 'should single quote the resource title' do
175
+ it 'singles quote the resource title' do
176
176
  expect(manifest).to eq("file { 'foo': }")
177
177
  end
178
178
  end
@@ -192,15 +192,15 @@ describe 'unquoted_resource_title' do
192
192
  END
193
193
  end
194
194
 
195
- it 'should only detect a single problem' do
195
+ it 'only detects a single problem' do
196
196
  expect(problems).to have(1).problem
197
197
  end
198
198
 
199
- it 'should fix the manifest' do
199
+ it 'fixes the manifest' do
200
200
  expect(problems).to contain_fixed(msg).on_line(1).in_column(18)
201
201
  end
202
202
 
203
- it 'should single quote the resource title' do
203
+ it 'singles quote the resource title' do
204
204
  expect(manifest).to eq(fixed)
205
205
  end
206
206
  end
@@ -224,15 +224,15 @@ describe 'unquoted_resource_title' do
224
224
  END
225
225
  end
226
226
 
227
- it 'should only detect a single problem' do
227
+ it 'only detects a single problem' do
228
228
  expect(problems).to have(1).problem
229
229
  end
230
230
 
231
- it 'should fix the manifest' do
231
+ it 'fixes the manifest' do
232
232
  expect(problems).to contain_fixed(msg).on_line(3).in_column(13)
233
233
  end
234
234
 
235
- it 'should single quote the resource title' do
235
+ it 'singles quote the resource title' do
236
236
  expect(manifest).to eq(fixed)
237
237
  end
238
238
  end
@@ -7,7 +7,7 @@ describe 'double_quoted_strings' do
7
7
  context 'double quoted string containing a variable inside single quotes' do
8
8
  let(:code) { "exec { \"/usr/bin/wget -O - '${source}' | /usr/bin/apt-key add -\": }" }
9
9
 
10
- it 'should not detect any problems' do
10
+ it 'does not detect any problems' do
11
11
  expect(problems).to have(0).problems
12
12
  end
13
13
  end
@@ -15,11 +15,11 @@ describe 'double_quoted_strings' do
15
15
  context 'multiple strings in a line' do
16
16
  let(:code) { "\"aoeu\" '${foo}'" }
17
17
 
18
- it 'should only detect a single problem' do
18
+ it 'only detects a single problem' do
19
19
  expect(problems).to have(1).problem
20
20
  end
21
21
 
22
- it 'should create a warning' do
22
+ it 'creates a warning' do
23
23
  expect(problems).to contain_warning(msg).on_line(1).in_column(1)
24
24
  end
25
25
  end
@@ -27,7 +27,7 @@ describe 'double_quoted_strings' do
27
27
  context 'double quoted string nested in a single quoted string' do
28
28
  let(:code) { "'grep \"status=sent\" /var/log/mail.log'" }
29
29
 
30
- it 'should not detect any problems' do
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 'double_quoted_strings' do
35
35
  context 'double quoted string after a comment' do
36
36
  let(:code) { "service { 'foo': } # \"bar\"" }
37
37
 
38
- it 'should not detect any problems' do
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 'double_quoted_strings' do
43
43
  context 'double quoted string containing newline but no variables' do
44
44
  let(:code) { %("foo\n") }
45
45
 
46
- it 'should not detect any problems' do
46
+ it 'does not detect any problems' do
47
47
  expect(problems).to have(0).problems
48
48
  end
49
49
  end
@@ -64,7 +64,7 @@ describe 'double_quoted_strings' do
64
64
  END
65
65
  end
66
66
 
67
- it 'should not detect any problems' do
67
+ it 'does not detect any problems' do
68
68
  expect(problems).to have(0).problems
69
69
  end
70
70
  end
@@ -72,11 +72,11 @@ describe 'double_quoted_strings' do
72
72
  context 'double quoted true' do
73
73
  let(:code) { "class { 'foo': boolFlag => \"true\" }" }
74
74
 
75
- it 'should only detect a single problem' do
75
+ it 'only detects a single problem' do
76
76
  expect(problems).to have(1).problem
77
77
  end
78
78
 
79
- it 'should create a warning' do
79
+ it 'creates a warning' do
80
80
  expect(problems).to contain_warning(msg).on_line(1).in_column(28)
81
81
  end
82
82
  end
@@ -84,11 +84,11 @@ describe 'double_quoted_strings' do
84
84
  context 'double quoted false' do
85
85
  let(:code) { "class { 'foo': boolFlag => \"false\" }" }
86
86
 
87
- it 'should only detect a single problem' do
87
+ it 'only detects a single problem' do
88
88
  expect(problems).to have(1).problem
89
89
  end
90
90
 
91
- it 'should create a warning' do
91
+ it 'creates a warning' do
92
92
  expect(problems).to contain_warning(msg).on_line(1).in_column(28)
93
93
  end
94
94
  end
@@ -103,10 +103,11 @@ describe 'double_quoted_strings' do
103
103
  $string5 = "this string contains \\'escaped \\' single quotes"
104
104
  $string6 = "this string contains \r carriage return"
105
105
  $string7 = "this string contains \\\\ an escaped backslash"
106
+ $string8 = "this string contains \\s"
106
107
  END
107
108
  end
108
109
 
109
- it 'should not detect any problems' do
110
+ it 'does not detect any problems' do
110
111
  expect(problems).to have(0).problems
111
112
  end
112
113
  end
@@ -114,11 +115,11 @@ describe 'double_quoted_strings' do
114
115
  context 'double quoted string with random escape should be rejected' do
115
116
  let(:code) { %( $ztring = "this string contains \l random escape" ) }
116
117
 
117
- it 'should only detect a single problem' do
118
+ it 'only detects a single problem' do
118
119
  expect(problems).to have(1).problem
119
120
  end
120
121
 
121
- it 'should create a warning' do
122
+ it 'creates a warning' do
122
123
  expect(problems).to contain_warning(msg).on_line(1).in_column(12)
123
124
  end
124
125
  end
@@ -126,7 +127,7 @@ describe 'double_quoted_strings' do
126
127
  context 'single quotes in a double quoted string' do
127
128
  let(:code) { "\"this 'string' 'has' lots of 'quotes'\"" }
128
129
 
129
- it 'should not detect any problems' do
130
+ it 'does not detect any problems' do
130
131
  expect(problems).to have(0).problems
131
132
  end
132
133
  end
@@ -134,29 +135,29 @@ describe 'double_quoted_strings' do
134
135
  context 'double quoted string containing single quoted string' do
135
136
  let(:code) { %(notify { "'foo'": }) }
136
137
 
137
- it 'should not detect any problems' do
138
+ it 'does not detect any problems' do
138
139
  expect(problems).to have(0).problems
139
140
  end
140
141
  end
141
142
  end
142
143
 
143
144
  context 'with fix enabled' do
144
- before do
145
+ before(:each) do
145
146
  PuppetLint.configuration.fix = true
146
147
  end
147
148
 
148
- after do
149
+ after(:each) do
149
150
  PuppetLint.configuration.fix = false
150
151
  end
151
152
 
152
153
  context 'double quoted string containing a variable inside single quotes' do
153
154
  let(:code) { "exec { \"/usr/bin/wget -O - '${source}' | /usr/bin/apt-key add -\": }" }
154
155
 
155
- it 'should not detect any problems' do
156
+ it 'does not detect any problems' do
156
157
  expect(problems).to have(0).problems
157
158
  end
158
159
 
159
- it 'should not modify the manifest' do
160
+ it 'does not modify the manifest' do
160
161
  expect(manifest).to eq(code)
161
162
  end
162
163
  end
@@ -164,11 +165,11 @@ describe 'double_quoted_strings' do
164
165
  context 'double quoted string containing a lone dollar' do
165
166
  let(:code) { "\"sed -i 's/^;*[[:space:]]*${name}[[:space:]]*=.*$/${name} = ${value}/g' file\"" }
166
167
 
167
- it 'should not detect any problems' do
168
+ it 'does not detect any problems' do
168
169
  expect(problems).to have(0).problems
169
170
  end
170
171
 
171
- it 'should not modify the manifest' do
172
+ it 'does not modify the manifest' do
172
173
  expect(manifest).to eq(code)
173
174
  end
174
175
  end
@@ -176,15 +177,15 @@ describe 'double_quoted_strings' do
176
177
  context 'multiple strings in a line' do
177
178
  let(:code) { "\"aoeu\" '${foo}'" }
178
179
 
179
- it 'should only detect a single problem' do
180
+ it 'only detects a single problem' do
180
181
  expect(problems).to have(1).problem
181
182
  end
182
183
 
183
- it 'should fix the manifest' do
184
+ it 'fixes the manifest' do
184
185
  expect(problems).to contain_fixed(msg).on_line(1).in_column(1)
185
186
  end
186
187
 
187
- it 'should convert the double quoted string into single quotes' do
188
+ it 'converts the double quoted string into single quotes' do
188
189
  expect(manifest).to eq("'aoeu' '${foo}'")
189
190
  end
190
191
  end
@@ -192,11 +193,11 @@ describe 'double_quoted_strings' do
192
193
  context 'single quotes in a double quoted string' do
193
194
  let(:code) { "\"this 'string' 'has' lots of 'quotes'\"" }
194
195
 
195
- it 'should not detect any problems' do
196
+ it 'does not detect any problems' do
196
197
  expect(problems).to have(0).problems
197
198
  end
198
199
 
199
- it 'should not modify the manifest' do
200
+ it 'does not modify the manifest' do
200
201
  expect(manifest).to eq(code)
201
202
  end
202
203
  end
@@ -7,11 +7,11 @@ describe 'only_variable_string' do
7
7
  context 'string containing only a variable' do
8
8
  let(:code) { '"${foo}"' }
9
9
 
10
- it 'should only detect a single problem' do
10
+ it 'only detects a single problem' do
11
11
  expect(problems).to have(1).problem
12
12
  end
13
13
 
14
- it 'should create a warning' do
14
+ it 'creates a warning' do
15
15
  expect(problems).to contain_warning(msg).on_line(1).in_column(4)
16
16
  end
17
17
  end
@@ -19,11 +19,11 @@ describe 'only_variable_string' do
19
19
  context 'string containing only a variable w/ ref' do
20
20
  let(:code) { '"${foo[0]}"' }
21
21
 
22
- it 'should only detect a single problem' do
22
+ it 'only detects a single problem' do
23
23
  expect(problems).to have(1).problem
24
24
  end
25
25
 
26
- it 'should create a warning' do
26
+ it 'creates a warning' do
27
27
  expect(problems).to contain_warning(msg).on_line(1).in_column(4)
28
28
  end
29
29
  end
@@ -31,11 +31,11 @@ describe 'only_variable_string' do
31
31
  context 'string containing only a variable w/ lots of refs' do
32
32
  let(:code) { '"${foo[0][aoeuaoeu][bar][999]}"' }
33
33
 
34
- it 'should only detect a single problem' do
34
+ it 'only detects a single problem' do
35
35
  expect(problems).to have(1).problem
36
36
  end
37
37
 
38
- it 'should create a warning' do
38
+ it 'creates a warning' do
39
39
  expect(problems).to contain_warning(msg).on_line(1).in_column(4)
40
40
  end
41
41
  end
@@ -50,33 +50,33 @@ describe 'only_variable_string' do
50
50
  END
51
51
  end
52
52
 
53
- it 'should not detect any problems' do
53
+ it 'does not detect any problems' do
54
54
  expect(problems).to be_empty
55
55
  end
56
56
  end
57
57
  end
58
58
 
59
59
  context 'with fix enabled' do
60
- before do
60
+ before(:each) do
61
61
  PuppetLint.configuration.fix = true
62
62
  end
63
63
 
64
- after do
64
+ after(:each) do
65
65
  PuppetLint.configuration.fix = false
66
66
  end
67
67
 
68
68
  context 'string containing only a variable' do
69
69
  let(:code) { '"${foo}"' }
70
70
 
71
- it 'should only detect a single problem' do
71
+ it 'only detects a single problem' do
72
72
  expect(problems).to have(1).problem
73
73
  end
74
74
 
75
- it 'should fix the manifest' do
75
+ it 'fixes the manifest' do
76
76
  expect(problems).to contain_fixed(msg).on_line(1).in_column(4)
77
77
  end
78
78
 
79
- it 'should unquote the variable' do
79
+ it 'unquotes the variable' do
80
80
  expect(manifest).to eq('$foo')
81
81
  end
82
82
  end
@@ -84,15 +84,15 @@ describe 'only_variable_string' do
84
84
  context 'string contaiting only a variable w/ ref' do
85
85
  let(:code) { '"${foo[0]}"' }
86
86
 
87
- it 'should only detect a single problem' do
87
+ it 'only detects a single problem' do
88
88
  expect(problems).to have(1).problem
89
89
  end
90
90
 
91
- it 'should fix the manifest' do
91
+ it 'fixes the manifest' do
92
92
  expect(problems).to contain_fixed(msg).on_line(1).in_column(4)
93
93
  end
94
94
 
95
- it 'should unquoted the variable' do
95
+ it 'unquotes the variable' do
96
96
  expect(manifest).to eq('$foo[0]')
97
97
  end
98
98
  end
@@ -100,15 +100,15 @@ describe 'only_variable_string' do
100
100
  context 'string containing only a variable w/ lots of refs' do
101
101
  let(:code) { '"${foo[0][aoeuaoeu][bar][999]}"' }
102
102
 
103
- it 'should only detect a single problem' do
103
+ it 'only detects a single problem' do
104
104
  expect(problems).to have(1).problem
105
105
  end
106
106
 
107
- it 'should fix the manifest' do
107
+ it 'fixes the manifest' do
108
108
  expect(problems).to contain_fixed(msg).on_line(1).in_column(4)
109
109
  end
110
110
 
111
- it 'should unquote the variable' do
111
+ it 'unquotes the variable' do
112
112
  expect(manifest).to eq('$foo[0][aoeuaoeu][bar][999]')
113
113
  end
114
114
  end