-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy path.swiftlint.yml
209 lines (180 loc) · 6.09 KB
/
.swiftlint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
excluded:
- Pods
- Carthage
- .build
disabled_rules:
- blanket_disable_command
- cyclomatic_complexity
- file_length
- force_cast
- force_try
- force_unwrapping
- function_body_length
- function_parameter_count
- line_length
- missing_docs
- nesting
- todo
- type_body_length
- type_name
- identifier_name
- large_tuple
- unused_optional_binding
- discarded_notification_center_observer
- unused_closure_parameter
- operator_whitespace
- multiple_closures_with_trailing_closure
- shorthand_operator
- weak_delegate
- void_function_in_ternary
opt_in_rules:
- closure_spacing
- contains_over_first_not_nil
- discouraged_object_literal
- empty_string
- first_where
- implicit_return
- joined_default_parameter
- no_extension_access_modifier
- overridden_super_call
- redundant_nil_coalescing
- syntactic_sugar
- toggle_bool
switch_case_alignment:
indented_cases: true
custom_rules:
icc_import_xcore:
name: "Import Xcore"
regex: "^import Xcore$"
match_kinds:
- identifier
- keyword
message: "Xcore is imported globally. Please remove this import."
icc_equal_space:
regex: "(?:([ ]{2,}=)|(=[ ]{2,}))"
message: "Expected only one space before and after ="
match_kinds:
- argument
- attribute.builtin
- attribute.id
- buildconfig.id
- buildconfig.keyword
- identifier
- keyword
- number
- objectliteral
- parameter
- placeholder
- string
- string_interpolation_anchor
- typeidentifier
icc_comma_space:
regex: ",[ ]{2,}"
message: "Expected only one space after ',"
icc_double_space:
name: "Double space"
regex: "([a-z,A-Z] \\s+)"
message: "Double space between keywords"
match_kinds: keyword
icc_brackets_space:
name: "Extra space"
regex: "\\{ \\}"
message: "Don't include spaces in empty brackets (e.g, {})."
icc_comments_space:
name: "Space After Comment"
regex: "(^ *//\\w+)"
message: "There should be a space after //"
icc_unnecessary_type:
name: "Unnecessary Type"
regex: "[ a-zA-Z0-9]*(?:let|var) [ a-zA-Z0-9]*: ([a-zA-Z0-9]*)[\\? ]*= \\1"
message: "Type definition not needed"
icc_weak_capture_space:
regex: "\\{\\[weak"
message: "Expected a space between [{"
inc_weak_self:
name: "Inconsistent Naming Convention"
regex: "weakSelf"
message: "Rename `weakSelf` to be `strongSelf` to follow codebase naming convention."
inc_if_necessary:
name: "Inconsistent Naming Convention"
regex: "IfNecessary"
message: "Rename `IfNecessary` to be `IfNeeded` to follow UIKit and codebase naming convention."
icc_verbose_naming:
name: "Verbose"
regex: "axis: \\[.horizontal, .vertical\\]"
message: "Replace `axis: [.horizontal, .vertical]` with `axis: .both` to follow codebase convention."
icc_override_func:
regex: "override (open|public|private|internal|fileprivate)"
message: "Use open override or public override instead"
icc_vertical_whitespace_opening_braces:
included: ".*.swift"
regex: '[{(\[][ \t]*\n[ \t]*\n'
name: "Vertical Whitespace after Opening Braces"
message: "Don't include vertical whitespace (empty line) after opening braces."
icc_vertical_whitespace_closing_braces:
included: ".*.swift"
regex: '\n[ \t]*\n[ \t]*[)}\]]'
name: "Vertical Whitespace before Closing Braces"
message: "Don't include vertical whitespace (empty line) before closing braces."
inconsistent_mark_declaration:
included: ".*.swift"
regex: '// MARK: [^-]'
message: "Add \"-\" after MARK declaration (e.g., // MARK: - Example)."
inc_parameter_capitalized:
included: ".*.swift"
regex: '/// - parameter'
message: "parameter should be capitalized."
inc_return_capitalized:
included: ".*.swift"
regex: '/// - returns'
message: "returns should be capitalized."
icc_action_block:
included: ".*.swift"
name: "Inconsistent Coding Convention"
regex: 'addAction\(.touchUpInside\)'
message: "Use `action { }` instead of `addAction(.touchUpInside)` codebase convention."
icc_omit_return:
included: ".*.swift"
name: "Inconsistent Coding Convention"
regex: '(\{ return #function \}|\{ return propertyName\(\) \})'
message: "Omit return from single line statement."
icc_omit_type:
included: ".*.swift"
name: "Inconsistent Coding Convention"
regex: '\: ImageAssetIdentifier (\{ #function \}|\{ propertyName\(\) \})'
message: "Replace ImageAssetIdentifier with Self."
sui_icc_env_namespace:
included: ".*.swift"
name: "Inconsistent Coding Convention"
regex: \@SwiftUI.Environment\(\\.[A-Za-z0-9_]*\)\s
message: "Remove SwiftUI namespace (e.g., `@SwiftUI.Environment → @Environment`)."
sui_icc_env_private:
included: ".*.swift"
name: "Inconsistent Coding Convention"
regex: \@Environment\(\\.[A-Za-z0-9_]*\)(\svar\s[A-Za-z0-9_:]*)
message: "Make environment variable private (e.g., `@Environment(\\.theme) private var theme`)."
sui_icc_env_type:
included: ".*.swift"
name: "Inconsistent Coding Convention"
regex: "\\@(Environment|SwiftUI.Environment)\\(\\\\.theme\\) private var theme: Theme"
message: "Remove type from the right hand of the environment variable (e.g., `@Environment(\\.theme) private var theme`)."
icc_system_image:
included: ".*.swift"
name: "Inconsistent Coding Convention"
regex: "systemImage: \""
message: "Use compile time constants instead of the strings API (e.g., `Image(system: .circle))`."
icc_system_image:
included: ".*.swift"
name: "Inconsistent Coding Convention"
regex: "systemName: \""
message: "Use compile time constants instead of the strings API (e.g., `Image(system: .circle))`."
icc_button_closure:
included: ".*.swift"
name: "Inconsistent Coding Convention"
regex: "Button\\(action\\: \\{"
message: "Please use the trailing closure syntax (e.g., `Button {} label: {}`)."
icc_file_header:
included: ".*.swift"
name: "Inconsistent Coding Convention"
regex: "// File.swift"
message: "Please update the file name."