puppet-lint-class_alignment-check 0.3.3 → 0.3.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0263490e2b13cd13ec0f9cb4e3d569d4a004aa11b6caa63b51c4c0b4cb2a405
|
4
|
+
data.tar.gz: aadc7259538098f01145ff841be78496c2ed04d9c799eb1a8d6d3a25d7df9ada
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb63b8f785be3ee853cab31c262c169acaeafd21100833e467c1ee8ae7cb4921aa8b877e42f8fe4a242dbca0b104c51637bbd9d62cdec9a2c1fc85d190451200
|
7
|
+
data.tar.gz: 49b6920703283013416902bfe3d28c0f57746127d2f20f07d21cd57aa29adc3bda5c6c12486c4639ab9a0997d0010007453e663ccf6fa4fd712eb3dda0e7e696
|
@@ -11,18 +11,26 @@ def a_param?(token)
|
|
11
11
|
elsif %i[DQPRE DQMID].include?(token&.prev_code_token&.type)
|
12
12
|
false
|
13
13
|
elsif token&.type == :VARIABLE
|
14
|
+
# first var in the class
|
15
|
+
if token&.prev_token_of(:CLASS)&.next_token_of(:LPAREN)&.next_token_of(:VARIABLE) == token
|
16
|
+
return true
|
17
|
+
elsif token&.prev_token_of(:DEFINE)&.next_token_of(:LPAREN)&.next_token_of(:VARIABLE) == token
|
18
|
+
return true
|
19
|
+
end
|
20
|
+
|
14
21
|
count = 0
|
15
22
|
while token&.prev_token
|
16
23
|
token = token.prev_token
|
17
|
-
|
24
|
+
return false if token.type == :EQUALS
|
25
|
+
|
26
|
+
if %i[RPAREN RBRACK RBRACE].include?(token.type)
|
18
27
|
count += 1
|
19
|
-
elsif %i[
|
28
|
+
elsif %i[LPAREN LBRACK LBRACE].include?(token.type)
|
20
29
|
count -= 1
|
21
|
-
elsif %i[DEFINE CLASS].include?(token.type)
|
22
|
-
break
|
23
30
|
end
|
31
|
+
|
32
|
+
return true if count.zero? && token.type == :COMMA
|
24
33
|
end
|
25
|
-
true if count == 1
|
26
34
|
end
|
27
35
|
end
|
28
36
|
|
@@ -123,6 +123,8 @@ describe 'class_params_newline' do
|
|
123
123
|
define long_ggg ($foo, $bar=[], $foo, $bar=[], $foo, $bar=[], $foo, $bar=[]) {}
|
124
124
|
|
125
125
|
define asdf ($prefix, $pattern, $expire, $port, $prefix, $pattern, $expire, $port) { }
|
126
|
+
|
127
|
+
define asdf ($prefix, $pattern, $expire, $port, $prefix, $pattern=$a and $b, $epe=-$foo, $port=!$foo) { }
|
126
128
|
END
|
127
129
|
end
|
128
130
|
|
@@ -212,6 +214,17 @@ describe 'class_params_newline' do
|
|
212
214
|
$expire,
|
213
215
|
$port
|
214
216
|
) { }
|
217
|
+
|
218
|
+
define asdf (
|
219
|
+
$prefix,
|
220
|
+
$pattern,
|
221
|
+
$expire,
|
222
|
+
$port,
|
223
|
+
$prefix,
|
224
|
+
$pattern=$a and $b,
|
225
|
+
$epe=-$foo,
|
226
|
+
$port=!$foo
|
227
|
+
) { }
|
215
228
|
END
|
216
229
|
end
|
217
230
|
|