Skip to content

Commit 0fff4ba

Browse files
committed
Add custom rule for array/dictionary initialization
1 parent 23b8ab2 commit 0fff4ba

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

com.raywenderlich.swiftlint.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ disabled_rules:
1010
- todo
1111
- unused_capture_list
1212

13-
1413
opt_in_rules:
1514
- array_init
1615
- attributes
@@ -53,6 +52,15 @@ opt_in_rules:
5352
- yoda_condition
5453

5554

55+
custom_rules:
56+
array_constructor:
57+
name: "Array/Dictionary initializer"
58+
regex: '[let,var] .+ = (\[.+\]\(\))'
59+
capture_group: 1
60+
message: "Use explicit type annotation when initializing arrays and dictionaries"
61+
severity: warning
62+
63+
5664
attributes:
5765
always_on_same_line:
5866
- "@IBSegueAction"

0 commit comments

Comments
 (0)