-
Notifications
You must be signed in to change notification settings - Fork 0
/
.swiftlint.yml
456 lines (308 loc) · 13 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
disabled_rules:
# Rationale: Arbitrary restriction
- cyclomatic_complexity
# Rationale: Allow String(data: data, encoding: .utf8) to be used
- non_optional_string_data_conversion
# Rationale: There are cases where you may want to declare the string enum value explicitly
- redundant_string_enum_value
opt_in_rules:
# Rationale: When using map, we think of it being used to transform a current array into something else
- array_init
# Rationale: Provides consistency in coding style
- attributes
# Rationale: Provides consistency in coding style and follows modern practices of the language
- block_based_kvo
# Rationale: Prevents retain cycles
- class_delegate_protocol
# Rationale: Provides consistency in coding style
- closing_brace
# Rationale: Provides consistency in coding style
- closure_parameter_position
# Rationale: Provides consistency in coding style
- closure_spacing
# Rationale: Provides consistency in coding style
- colon
# Rationale: Provides consistency in coding style
- comma
# Rationale: Provides consistency in coding style
- compiler_protocol_init
# Rationale: A more clear and consise way to check if something exists
- contains_over_filter_count
# Rationale: A more clear and consise way to check if something exists
- contains_over_filter_is_empty
# Rationale: A more clear and consise way to check if something exists
- contains_over_first_not_nil
# Rationale: A more clear and consise way to check if a range exists
- contains_over_range_nil_comparison
# Rationale: Provides consistency in coding style and follows modern practices of the language
- control_statement
# Rationale: Encourages proper memory practices
- discarded_notification_center_observer
# Rationale: Prevents coder error
- discouraged_direct_init
# Rationale: A nil bool is a tri-state variable which can be modeled more clearly
- discouraged_optional_boolean
# Rationale: Imports are not required more than once.
- duplicate_imports
# Rationale: Prevents coder error
- dynamic_inline
# Rationale: Provides consistency in coding style
- empty_collection_literal
# Rationale: Provides consistency in coding style and follows modern practices of the language
- empty_count
# Rationale: Provides consistency in coding style and brevity.
- empty_enum_arguments
# Rationale: Provides consistency in coding style and follows modern practices of the language
- empty_parameters
# Rationale: Provides consistency in coding style
- empty_parentheses_with_trailing_closure
# Rationale: Provides consistency in coding style and follows modern practices of the language
- empty_string
# Rationale: Provides consistency in coding style
- explicit_init
# Rationale: Prevents coder error
- fallthrough
# Rationale: Encourages better documentation
- fatal_error_message
# Rationale: Encourages using the right API to solve a problem
- first_where
# Rationale: Provides consistency in coding style
- flatmap_over_map_reduce
# Rationale: Encourages using the right API to solve a problem
- for_where
# Rationale: Prevents coder error, doesn't crash, makes coder be explicit about their assumptions
- force_cast
# Rationale: Prevents coder error, doesn't crash, makes coder be explicit about their assumptions
- force_try
# Rationale: Prevents coder error, doesn't crash, makes coder be explicit about their assumptions
- force_unwrapping
# Rationale: Provides consistency in coding style and brevity.
- implicit_getter
# Rationale: Prevents coder error, doesn't crash, makes coder be explicit about their assumptions
- implicitly_unwrapped_optional
# Rationale: Encourages using the right API to solve a problem
- is_disjoint
# Rationale: Provides clarity and consistency by using the default parameter
- joined_default_parameter
# Rationale: Provides consistency in coding style
- last_where
# Rationale: Provides consistency in coding style
- leading_whitespace
# Rationale: Provides consistency in coding style and follows modern practices of the language
- legacy_cggeometry_functions
# Rationale: Provides consistency in coding style and follows modern practices of the language
- legacy_constant
# Rationale: Provides consistency in coding style and follows modern practices of the language
- legacy_constructor
# Rationale: Provides consistency in coding style and follows modern practices of the language
- legacy_hashing
# Rationale: Provides consistency in coding style and follows modern practices of the language
- legacy_nsgeometry_functions
# Rationale: Usage of proper access level
- lower_acl_than_parent
# Rationale: Provides consistency in coding style
- mark
# Rationale: Provides consistency in coding style
- multiline_parameters
# Rationale: Clarity of code
- multiple_closures_with_trailing_closure
# Rationale: Provides consistency in coding style
- no_space_in_method_call
# Rationale: Encourages coder best practices though language feature likely makes this obsolete
- notification_center_detachment
# Rationale: Provides consistency in coding style
- opening_brace
# Rationale: Provides consistency in coding style
- operator_usage_whitespace
# Rationale: Provides consistency in coding style
- operator_whitespace
# Rationale: Prevents coder error
- overridden_super_call
# Rationale: Prevents unpredictable behavior
- override_in_extension
# Rationale: Promotes consistency and reduces duplication.
- pattern_matching_keywords
# Rationale: Keep internal details from being overexposed
- private_over_fileprivate
# Rationale: Prevents coder error
- private_unit_test
# Rationale: Prevents coder error
- prohibited_super_call
# Rationale: Provides consistency in coding style
- protocol_property_accessors_order
# Rationale: Provides consistency in coding style and brevity
- redundant_discardable_let
# Rationale: Provides consistency in coding style and brevity
- redundant_nil_coalescing
# Rationale: Provides consistency in coding style and brevity
- redundant_objc_attribute
# Rationale: Provides consistency in coding style and brevity
- redundant_optional_initialization
# Rationale: Provides consistency in coding style and brevity
- redundant_void_return
# Rationale: Provides consistency in coding style
- required_enum_case
# Rationale: Provides consistency in coding style
- return_arrow_whitespace
# Rationale: Provides consistency in coding style
- shorthand_operator
# Rationale: There should be only XCTestCase per file
- single_test_class
# Rationale: Provides consistency and clarity in coding style and is less code
- sorted_first_last
# Rationale: Provides consistency in coding style
- statement_position
# Rationale: Provides cleaniness of code
- superfluous_disable_command
# Rationale: Provides consistency in coding style
- switch_case_alignment
# Rationale: Provides consistency in coding style and follows modern practices of the language
- syntactic_sugar
# Rationale: Provides consistency in coding style
- trailing_newline
# Rationale: Provides consistency in coding style and follows modern practices of the language
- trailing_semicolon
# Rationale: Provides consistency in coding style and brevity
- unneeded_break_in_switch
# Rationale: Provides consistency in coding style and brevity
- unused_control_flow_label
# Rationale: Provides consistency in coding style and brevity
- unused_closure_parameter
# Rationale: Provides consistency in coding style and brevity
- unused_enumerated
# Rationale: Provides consistency in coding style and brevity
- unused_optional_binding
# Rationale: Avoids issues where the setter is not using the value passed in.
- unused_setter_value
# Rationale: Prevents coder error
- valid_ibinspectable
# Rationale: Provides consistency in coding style
- vertical_parameter_alignment
# Rationale: Provides consistency in coding style
- vertical_parameter_alignment_on_call
# Rationale: Provides consistency in coding style
- vertical_whitespace
# Rationale: Provides consistency in coding style
- vertical_whitespace_closing_braces
# Rationale: Provides consistency in coding style and follows modern practices of the language
- void_return
# Rationale: Prevents retain cycles and coder error
- weak_delegate
# Rationale: Encourages better documentation
- xctfail_message
# Rationale: Provides consistency in coding style
- yoda_condition
# Rationale: Provides consistency in coding style.
- reduce_boolean
# Rationale: == is not used for NSObject comparison, and could lead to confusion.
- nsobject_prefer_isequal
# Rationale: Prevents issues with using unowned.
- unowned_variable_capture
# Rationale: Ensures all enums can be switched upon.
- duplicate_enum_cases
# Rationale: Provides consistency in coding style.
- legacy_multiple
# Closure end should have the same indentation as the line that started it.
- closure_end_indentation
# All elements in a collection literal should be vertically aligned
- collection_alignment
# Prefer // comment over //comment
- comment_spacing
# Refer assertionFailure() over assert(false)
- discouraged_assert
# Discourage enum cases that interfere with Optional<T>.none and type checking.
- discouraged_none_name
# Encourages initializers over object literals
- discouraged_object_literal
# Empty XCTest methods should be avoided.
- empty_xctest_method
# Swift files must have our copyright header info.
- file_header
# Comparing two identical operands is likely a mistake.
- identical_operands
# Customized identifier name rules
- identifier_name
# Let and var should be separated from other statements by a blank line.
- let_var_whitespace
# Array and dictionary literal end should have the same indentation as the line that started it.
- literal_expression_end_indentation
# Modifier order should be consistent
- modifier_order
# Static strings should be used as a key/comment in NSLocalizedString in order for genstrings to work.
- nslocalizedstring_key
# Matching an enum case against an optional enum without '?' is supported on Swift 5.1 and above.
- optional_enum_case_matching
# Using Self to reference a Type when possible is more stable
- prefer_self_in_static_references
# Prefer `Self` over `type(of: self)` when accessing properties or calling methods.
- prefer_self_type_over_type_of_self
# Prefer `.zero` over explicit init with zero parameters (e.g., `CGPoint(x: 0, y: 0)`)
- prefer_zero_over_explicit_init
# Mutable reference can be faster than repeated copying
- reduce_into
# Catch uses of self inside an inline closure used for initializing a variable
- self_in_property_initialization
# Operators should be declared as static functions, not free functions.
- static_operator
# Test case API should be private for that test case
- test_case_accessibility
# Prefer `someBool.toggle()` over `someBool = !someBool`
- toggle_bool
# Parentheses are not needed when declaring closure arguments.
- unneeded_parentheses_in_closure_argument
# Test classes must implement balanced setUp and tearDown methods
- balanced_xctest_lifecycle
# Types used for hosting only static members should be implemeted as a caseless enum to avoid instantiation.
- convenience_type
# Number of associated values in an enum should be low
- enum_case_associated_values_count
# Arguments should be either on the same line, or one per line
- multiline_arguments
# Multiline arguments should have their surrounding brackets in a new line.
- multiline_arguments_brackets
# Chained function calls should be either on the same line, or one per line.
- multiline_function_chains
# Multiline literals should have their surrounding brackets in a new line.
- multiline_literal_brackets
# Multiline parameters should have their surrounding brackets in a new line.
- multiline_parameters_brackets
# Trailing closure syntax should be used whenever possible.
- trailing_closure
# Uncallable or unreachabable implimentations should be marked unavailable
- unavailable_function
# Catch statements should not declare error variables without type casting.
- untyped_error_in_catch
# Prefer specific XCTest matchers over `XCTAssertEqual` and `XCTAssertNotEqual`
- xct_specific_matcher
attributes:
always_on_same_line: ["@IBAction", "@IBSegueAction", "@NSManaged", "@escaping", "@objc", "@frozen"]
file_length:
warning: 1000
error: 2000
function_body_length:
warning: 200
error: 300
identifier_name:
min_length: 1
max_length:
warning: 60
error: 80
allowed_symbols: ["_"]
validates_start_with_lowercase: error
inclusive_language:
override_allowed_terms: ["master", "blacklist", "whitelist"]
large_tuple:
warning: 3
error: 3
line_length:
warning: 400
error: 400
nesting:
type_level: 2
function_level: 5
trailing_comma:
mandatory_comma: true
type_name:
max_length:
warning: 75
error: 75