puppet-lint-manifest_whitespace-check 0.2.1 → 0.2.2
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: bd465f6f8f5fe07dc5de6b9a9c3eb36e8f99e5c647e3d48a6001cd0f32749cf9
|
4
|
+
data.tar.gz: e0bb7d7f3ee60d7bfed54e28ee24b78dae5a8477b870e41b33902bb86b3a5407
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85069ac6a3e3c7a349eea0e102a35f737204b210d35caf451e71ccd04da54bc241061947be20a93dc2adfc4a0ca91bc429243c27b7d4c50cc2fe072971dfecfd
|
7
|
+
data.tar.gz: a7bde6a55568780469a5576c2353d77108c86e5e6ca84a448992fb9549dd89530f140ca2a1aae1f268145c25321b3acc8467706215a16fd90093043016691459
|
@@ -8,9 +8,9 @@ PuppetLint.new_check(:manifest_whitespace_opening_brace_before) do
|
|
8
8
|
|
9
9
|
next unless prev_token && prev_code_token
|
10
10
|
|
11
|
-
next if %i[COLON].include?(prev_code_token.type)
|
11
|
+
next if %i[COMMENT COLON].include?(prev_code_token.type)
|
12
12
|
|
13
|
-
if %i[
|
13
|
+
if %i[LPAREN LBRACK LBRACE].include?(prev_code_token.type)
|
14
14
|
next if tokens.index(prev_code_token) == tokens.index(brace_token) - 1
|
15
15
|
next if tokens[tokens.index(prev_code_token)..tokens.index(brace_token)].collect(&:type).include?(:NEWLINE)
|
16
16
|
|
@@ -35,13 +35,16 @@ PuppetLint.new_check(:manifest_whitespace_opening_brace_before) do
|
|
35
35
|
prev_code_token = prev_non_space_token(token)
|
36
36
|
|
37
37
|
while prev_code_token != prev_token
|
38
|
-
|
38
|
+
if !%i[LPAREN LBRACK LBRACE].include?(prev_code_token.type) &&
|
39
|
+
%i[WHITESPACE INDENT NEWLINE].include?(prev_token.type)
|
40
|
+
raise PuppetLint::NoFix
|
41
|
+
end
|
39
42
|
|
40
43
|
remove_token(prev_token)
|
41
44
|
prev_token = prev_token.prev_token
|
42
45
|
end
|
43
46
|
|
44
|
-
add_token(tokens.index(token), new_single_space)
|
47
|
+
add_token(tokens.index(token), new_single_space) unless %i[LPAREN LBRACK LBRACE].include?(prev_code_token.type)
|
45
48
|
end
|
46
49
|
end
|
47
50
|
|
@@ -51,7 +54,7 @@ PuppetLint.new_check(:manifest_whitespace_opening_brace_after) do
|
|
51
54
|
next_token = brace_token.next_token
|
52
55
|
|
53
56
|
next unless next_token && !is_single_space(next_token)
|
54
|
-
next if %i[RBRACE].include?(next_token.type)
|
57
|
+
next if %i[RBRACE LBRACK LBRACE].include?(next_token.type)
|
55
58
|
|
56
59
|
if next_token.type == :NEWLINE
|
57
60
|
next_token = next_token.next_token
|
@@ -19,6 +19,23 @@ describe 'manifest_whitespace_opening_brace_before' do
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
context 'inside, inline with function' do
|
23
|
+
let(:code) do
|
24
|
+
<<~EOF
|
25
|
+
$sssd_config = {
|
26
|
+
▏ 'sssd' => merge($config, {
|
27
|
+
▏ ▏ ▏ 'domains' => $domains,
|
28
|
+
▏ ▏ ▏ 'services' => 'nss,pam',
|
29
|
+
▏ }),
|
30
|
+
}
|
31
|
+
EOF
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should detect no problems' do
|
35
|
+
expect(problems).to be_empty
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
22
39
|
context 'inside interpolation' do
|
23
40
|
let(:code) do
|
24
41
|
<<~EOF
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-lint-manifest_whitespace-check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jo Vandeginste
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2022-10-10 00:00:00.000000000 Z
|
@@ -151,7 +151,7 @@ licenses:
|
|
151
151
|
- MIT
|
152
152
|
metadata:
|
153
153
|
rubygems_mfa_required: 'true'
|
154
|
-
post_install_message:
|
154
|
+
post_install_message:
|
155
155
|
rdoc_options: []
|
156
156
|
require_paths:
|
157
157
|
- lib
|
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
167
|
version: '0'
|
168
168
|
requirements: []
|
169
169
|
rubygems_version: 3.3.7
|
170
|
-
signing_key:
|
170
|
+
signing_key:
|
171
171
|
specification_version: 4
|
172
172
|
summary: A puppet-lint check to validate whitespace in manifests
|
173
173
|
test_files: []
|