-
Notifications
You must be signed in to change notification settings - Fork 2
/
.swiftlint.yml
executable file
·117 lines (98 loc) · 2.35 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
# paths to ignore during linting. Takes precedence over `included`.
excluded:
- Carthage
- Pods
# Rules
opt_in_rules:
- anyobject_protocol
- array_init
- closure_body_length
- closure_end_indentation
- closure_spacing
- collection_alignment
- conditional_returns_on_newline
- contains_over_filter_count
- contains_over_filter_is_empty
- contains_over_first_not_nil
- contains_over_range_nil_comparison
- convenience_type
- empty_collection_literal
- empty_string
- empty_xctest_method
- enum_case_associated_values_count
- explicit_init
- file_header
- file_name_no_space
- first_where
- flatmap_over_map_reduce
- force_unwrapping
- identical_operands
- implicitly_unwrapped_optional
- joined_default_parameter
- last_where
- legacy_random
- modifier_order
- multiline_parameters
- overridden_super_call
- prefer_self_type_over_type_of_self
- private_action
- prohibited_super_call
- sorted_first_last
- toggle_bool
- trailing_closure
- untyped_error_in_catch
- unused_declaration
- unused_import
- yoda_condition
colon:
apply_to_dictionaries: false
identifier_name:
excluded:
- id
- x
- y
- z
- to
- url
- up
statement_position:
statement_mode: uncuddled_else
switch_case_alignment:
indented_cases: true
# Constants
file_length:
warning: 1000
error: 1500
type_body_length:
warning: 800
error: 1000
function_body_length:
warning: 60
line_length: 140
function_parameter_count: 4
type_name:
min_length: 2 #only warning
# Others
type_contents_order:
order:
- case
- associated_type
- type_alias
- subtype
- [type_property, instance_property]
- [initializer, type_method, view_life_cycle_method, subscript, other_method, ib_action]
file_header:
required_pattern: |
\/\/
\/\/ Copyright © \d{4}\ .*?. All rights reserved.
\/\/
# Custom rules
custom_rules:
enum_cases_on_newline:
name: "Enum cases on newline"
regex: "^\\s*case[\\h\\S]*,(?![^(]*\\))[^:|,]+$"
message: "Enum cases should always start with a newline."
accessors_and_observers_on_newline:
name: "Property accessors and observers on newline"
regex: "^\\s*(get|set|didSet|willSet)[\\h\\S]\\{[\\h\\S]+$"
message: "Property accessors and observers should always start with a newline."