puppet-lint-manifest_whitespace-check 0.1.10 → 0.1.11
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dd5e8776e914e8e269dba2e5fc7b10b344cdd8f2f0bb9e7b41b88ac0eb5b782
|
4
|
+
data.tar.gz: 69807b0aa0325654cabc75395b93494eb5375c7d53319c1163536da82f320466
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff95eac15ab930d9dfeabcfdfbb126288c7ef4d2b98a9ef6547e11202970190a0e3e2a0eb5d9595cb8228613446792c4547c8a68527e5c1ae087755547f45dcc
|
7
|
+
data.tar.gz: 11c9f07ca69106a3212813b0228d3215b41614cdc9c0526e1c141ed0399e156a2e0800b544b4f9886c4ff4bd7af22286417073b56142b235e3901a66bf9d8843
|
@@ -55,8 +55,6 @@ PuppetLint.new_check(:manifest_whitespace_closing_bracket_after) do
|
|
55
55
|
next unless next_token
|
56
56
|
next if after_bracket_tokens.include?(next_token.type)
|
57
57
|
|
58
|
-
warn next_token.inspect
|
59
|
-
|
60
58
|
if next_token.type == :WHITESPACE
|
61
59
|
next_code_token = next_non_space_token(bracket_token)
|
62
60
|
next unless next_code_token
|
@@ -9,6 +9,9 @@ PuppetLint.new_check(:manifest_whitespace_opening_bracket_before) do
|
|
9
9
|
next unless prev_token && prev_code_token
|
10
10
|
next if %i[LBRACK LBRACE COMMA SEMIC].include?(prev_code_token.type)
|
11
11
|
next unless %i[WHITESPACE NEWLINE INDENT].include?(prev_token.type)
|
12
|
+
if prev_token.type == :NEWLINE && %i[RBRACK RBRACE].include?(prev_code_token.type)
|
13
|
+
next
|
14
|
+
end
|
12
15
|
next unless tokens.index(prev_code_token) != tokens.index(bracket_token) - 2 ||
|
13
16
|
!is_single_space(prev_token)
|
14
17
|
|
@@ -5,6 +5,22 @@ require 'spec_helper'
|
|
5
5
|
describe 'manifest_whitespace_opening_bracket_before' do
|
6
6
|
let(:opening_bracket_msg) { 'there should be a single space before an opening bracket' }
|
7
7
|
|
8
|
+
context 'with iterator' do
|
9
|
+
let(:code) do
|
10
|
+
<<~EOF
|
11
|
+
['ib0', 'ib1', 'ib2', 'ib3', 'pub', 'oob', '0', '184'].each |String $name| {
|
12
|
+
}
|
13
|
+
|
14
|
+
['ib0', 'ib1', 'ib2', 'ib3', 'pub', 'oob', '0', '184'].each |String $name| {
|
15
|
+
}
|
16
|
+
EOF
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should detect no problems' do
|
20
|
+
expect(problems).to have(0).problem
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
8
24
|
context 'with no spaces' do
|
9
25
|
let(:code) do
|
10
26
|
<<~EOF
|
@@ -228,6 +244,22 @@ end
|
|
228
244
|
describe 'manifest_whitespace_opening_bracket_after' do
|
229
245
|
let(:opening_bracket_msg) { 'there should be no whitespace or a single newline after an opening bracket' }
|
230
246
|
|
247
|
+
context 'with iterator' do
|
248
|
+
let(:code) do
|
249
|
+
<<~EOF
|
250
|
+
['ib0', 'ib1', 'ib2', 'ib3', 'pub', 'oob', '0', '184'].each |String $name| {
|
251
|
+
}
|
252
|
+
|
253
|
+
['ib0', 'ib1', 'ib2', 'ib3', 'pub', 'oob', '0', '184'].each |String $name| {
|
254
|
+
}
|
255
|
+
EOF
|
256
|
+
end
|
257
|
+
|
258
|
+
it 'should detect no problems' do
|
259
|
+
expect(problems).to have(0).problem
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
231
263
|
context 'with a single space' do
|
232
264
|
let(:code) do
|
233
265
|
<<~EOF
|