-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.swiftlint.yml
209 lines (193 loc) · 5.39 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
disabled_rules: # rule identifiers to exclude from running
- trailing_whitespace
- class_delegate_protocol
opt_in_rules: # some rules are only opt-in
- array_init
- closure_spacing
- closure_body_length
- collection_alignment
- contains_over_range_nil_comparison
- contains_over_filter_count
- contains_over_filter_is_empty
- contains_over_first_not_nil
- discouraged_object_literal
- discouraged_optional_boolean
- empty_collection_literal
- empty_string
- empty_count
- empty_xctest_method
- enum_case_associated_values_count
- explicit_init
- implicit_return
- implicitly_unwrapped_optional
- identical_operands
- force_unwrapping
- first_where
- fatal_error_message
- for_where
- flatmap_over_map_reduce
- generic_type_name
- modifier_order
- joined_default_parameter
- extension_access_modifier
- fallthrough
- closure_end_indentation
- attributes
- let_var_whitespace
- last_where
- legacy_multiple
- legacy_random
- multiline_parameters
- multiline_literal_brackets
- number_separator
- private_action
- prefer_zero_over_explicit_init
- prefer_self_type_over_type_of_self
- overridden_super_call
- prohibited_super_call
- redundant_nil_coalescing
- switch_case_on_newline
- trailing_closure
- vertical_parameter_alignment_on_call
- literal_expression_end_indentation
- lower_acl_than_parent
- operator_usage_whitespace
- operator_whitespace
- quick_discouraged_call
- untyped_error_in_catch
- multiline_function_chains
- file_name
- file_name_no_space
- file_types_order
- convenience_type
- reduce_into
- redundant_type_annotation
- single_test_class
- sorted_first_last
- static_operator
- toggle_bool
- trailing_comma
- unavailable_function
- unneeded_parentheses_in_closure_argument
- unowned_variable_capture
- yoda_condition
- vertical_whitespace
- vertical_whitespace_between_cases
- vertical_whitespace_closing_braces
- vertical_whitespace_opening_braces
included:
- ./Projects/
attributes:
always_on_same_line: ["@State", "@ObservedObject", "@MainActor", "@Binding", "@Published"]
always_on_line_above: []
severity: warning
# configurable rules can be customized from this configuration file
# binary rules can set their severity level
cyclomatic_complexity:
- 15
- 20
force_cast: warning # implicitly
force_try:
severity: warning # explicitly
# rules that have both warning and error levels, can set just the warning level
# implicitly
line_length: 250
# they can set both implicitly with an array
type_body_length:
- 300 # warning
- 400 # error
function_body_length:
- 100
- 200
# or they can set both explicitly
file_length:
warning: 500
error: 1200
ignore_comment_only_lines: true
# naming rules can set warnings/errors for min_length and max_length
# additionally they can set excluded names
type_name:
min_length: 3 # only warning
max_length: # warning and error
warning: 50
error: 60
excluded:
- iPhone # excluded via string
- In
- Out
- Err
- Bit
- Bits
- Geo
- Lan
- Tag
- Box
- Id
identifier_name:
min_length: # only min_length
error: 2 # only error
max_length:
warning: 50
error: 60
excluded: # excluded via string array
- id
- URL
- op
- x
- y
- ex
- pk
- vm
large_tuple:
warning: 3
error: 4
nesting:
type_level: 3
custom_rules:
comments_space: # From https://github.com/brandenr/swiftlintconfig
name: "Space After Comment"
regex: "(^ *//\\w+)"
message: "There should be a space after //"
severity: warning
double_space: # From https://github.com/IBM-Swift/Package-Builder
include: "*.swift"
name: "Double space"
regex: "([a-z,A-Z] \\s+)"
message: "Double space between keywords"
match_kinds: keyword
severity: warning
new_line_between_import:
name: "New line between import"
regex: "import(.*?)\n\n+import"
message: "No new line between import"
severity: warning
# numbers_smell:
# regex: '(return |case |\w\(|: |\?\? |\, |== |<=? |>=? |\+= |\-= |\/= |\*= |%= |\w\.\w+ = )\(*\d{2,}'
# message: "Numbers smell; define a constant instead."
# severity: warning
auto_generated_leftovers:
regex: 'func [^\n]*\{\n(\s*super\.[^\n]*\n(\s*\/\/[^\n]*\n)*|(\s*\/\/[^\n]*\n)+)\s*\}'
message: "Delete auto-generated functions that you don't use"
severity: warning
# empty_line_after_guard:
# regex: '(^ *guard[ a-zA-Z0-9=?.\(\),><!]*\{[ a-zA-Z0-9=?.\(\),><!]*\}\n *(?!(?:return|guard))\S+)'
# message: "There should be an empty line after a guard"
# severity: error
empty_line_after_super:
name: "Empty Line After Super"
regex: '(^ *super\.[ a-zA-Z0-9=?.\(\)\{\}:,><!]*\n *(?!(?:\}|return))\S+)'
message: "There should be an empty line after super"
severity: error
multiple_empty_lines:
name: "Multiple Empty Lines"
regex: '((?:\s*\n){3,})'
message: "There are too many line breaks"
severity: error
protocol_conformance:
included: ".*.swift"
name: "Protocol Conformance"
message: "Protocol conformance should be declared in separate extensions in the same file"
regex: "(class|struct|extension)[[:space:]]+(?i:(?![^d]*delegate:))[^'\"()<>{},!?:]+:([^'\"<>(){},!?:]+,)+[^'\"<>(){},!?:]*\\{"
match_kinds:
- keyword
severity: warning