puppet-lint-manifest_whitespace-check 0.2.1 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b3bc8cb98f4459ad929e160c0759c73e76fc6253c54061b4edea16370f8b38d
4
- data.tar.gz: ddc62ccbc2c3537f6057c73d498a035dc4007f416a8b435140a207aa8c0380f5
3
+ metadata.gz: 68ebf647e803e56c8a3fdb45055b756a31a8aad16ba5e2626d5f9c37b2cd3edf
4
+ data.tar.gz: 9e982b6494eb4a85e9853374c65ac21dc68431d506254d3975244f2ca9b1a902
5
5
  SHA512:
6
- metadata.gz: 59189f5b0b1922bfd04ef96b64f53662b5740ef3a20d8a34f44045fa90d194a4c94e41ca6440ada5b0ecb8b8ec3bb27631b85c02e61f59b4844a708665e417a2
7
- data.tar.gz: 3547dfb1ab41289ef4ad92168bbc02a12b0ae717b9e97146c0fc2cb13314a972cc1d1c191c0d4feaf73ac7604deb7b272ac90616693f980d1be224a2d498ec26
6
+ metadata.gz: 7af1583cd0809ca34d8e6aa4fd63353873a326c1372cc757fa625c20a478cf6f0bf6a72af032b38038c6fe51f18f01035862d9f3c5b0e28518db503869758b58
7
+ data.tar.gz: 9699d991b726203e67c2aac3c9c69aaa5a94888fb6196b2dfbdac402ae91db990a86b07ad16a83da2ec499aacbb1c3958be63d047afd1a86e679d571e9fa5980
@@ -8,9 +8,10 @@ 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[COMMA].include?(prev_code_token.type) && %i[INDENT NEWLINE].include?(prev_token.type)
12
+ next if %i[COMMENT COLON].include?(prev_code_token.type)
12
13
 
13
- if %i[COMMENT COMMA LPAREN LBRACK LBRACE].include?(prev_code_token.type)
14
+ if %i[LPAREN LBRACK LBRACE].include?(prev_code_token.type)
14
15
  next if tokens.index(prev_code_token) == tokens.index(brace_token) - 1
15
16
  next if tokens[tokens.index(prev_code_token)..tokens.index(brace_token)].collect(&:type).include?(:NEWLINE)
16
17
 
@@ -41,7 +42,7 @@ PuppetLint.new_check(:manifest_whitespace_opening_brace_before) do
41
42
  prev_token = prev_token.prev_token
42
43
  end
43
44
 
44
- add_token(tokens.index(token), new_single_space)
45
+ add_token(tokens.index(token), new_single_space) unless %i[LPAREN LBRACK LBRACE].include?(prev_code_token.type)
45
46
  end
46
47
  end
47
48
 
@@ -51,7 +52,7 @@ PuppetLint.new_check(:manifest_whitespace_opening_brace_after) do
51
52
  next_token = brace_token.next_token
52
53
 
53
54
  next unless next_token && !is_single_space(next_token)
54
- next if %i[RBRACE].include?(next_token.type)
55
+ next if %i[RBRACE LBRACK LBRACE].include?(next_token.type)
55
56
 
56
57
  if next_token.type == :NEWLINE
57
58
  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.1
4
+ version: 0.2.3
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: []