-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path.swiftlint.yml
267 lines (198 loc) · 7.75 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
opt_in_rules:
# Prefer using `AnyObject` over `class` for class-only protocols.
- anyobject_protocol
# Prefer using `Array(seq)` over `seq.map { $0 }` to convert a sequence into an Array.
- array_init
# Prefer the new block based KVO API with keypaths when using Swift 3.2 or later.
- block_based_kvo
# Closure end should have the same indentation as the line that started it.
- closure_end_indentation
# Closure expressions should have a single space inside each brace.
- closure_spacing
# Conditional statements should always return on the next line.
- conditional_returns_on_newline
# Prefer `contains` over `first(where:) != nil`.
- contains_over_first_not_nil
# Types used for hosting only static members should be implemented as a caseless enum to avoid instantiation.
- convenience_type
# Availability checks or attributes shouldn't be using older versions that are satisfied by the deployment target.
- deployment_target
# Prefer initializers over object literals.
- discouraged_object_literal
# Prefer non-optional booleans over optional booleans.
- discouraged_optional_boolean
# Prefer non-optional collections over optional collections.
- discouraged_optional_collection
# Imports should be unique.
- duplicate_imports
# Prefer checking isEmpty over comparing count to zero.
- empty_count
# Prefer checking isEmpty over comparing string to an empty string literal.
- empty_string
# Empty XCTest method should be avoided.
- empty_xctest_method
# Explicitly calling .init() should be avoided.
- explicit_init
# Prefer to use extension access modifiers.
- extension_access_modifier
# A fatalError call should have a message.
- fatal_error_message
# Header comments should be consistent with project patterns.
- file_header
# Prefer using .first(where:) over .filter { }.first in collections.
- first_where
# Force tries should be avoided.
- force_try
# Force unwrapping should be avoided.
- force_unwrapping
# Prefer implicit returns in closures.
- implicit_return
# If defer is at the end of its parent scope, it will be executed right where it is anyway.
- inert_defer
# Discouraged explicit usage of the default separator.
- joined_default_parameter
# Prefer using `.last(where:)` over `.filter { }.last` in collections.
- last_where
# Prefer using `type.random(in:)` over legacy functions.
- legacy_random
# Ensure definitions have a lower access control level than their enclosing parent
- lower_acl_than_parent
# Declarations should be documented.
- missing_docs
# Modifier order should be consistent.
- modifier_order
# Chained function calls should be either on the same line, or one per line
- multiline_function_chains
# Functions and methods parameters should be either on the same line, or one per line.
- multiline_parameters
# "Fallthroughs can only be used if the `case` contains at least one other statement.
- no_fallthrough_only
# Operators should be surrounded by a single whitespace when they are being used.
- operator_usage_whitespace
# Some overridden methods should always call super.
- overridden_super_call
# Top-level constants should be prefixed by k.
- prefixed_toplevel_constant
# IBActions should be private.
- private_action
# IBOutlets should be private to avoid leaking UIKit to higher layers.
- private_outlet
# Some methods should not call super.
- prohibited_super_call
# nil coalescing operator is only evaluated if the lhs is nil, coalescing operator with nil as rhs is redundant
- redundant_nil_coalescing
# Test files should contain a single QuickSpec or XCTestCase class.
- single_test_class
# Prefer using `min()` or `max()` over `sorted().first` or `sorted().last`.
- sorted_first_last
# Imports should be sorted.
- sorted_imports
# Operators should be declared as static functions, not free functions.
- static_operator
# @IBOutlets shouldn't be declared as weak.
- strong_iboutlet
# Cases inside a switch should always be on a newline.
- switch_case_on_newline
# When using trailing closures, empty parentheses should be avoided after the method call.
- trailing_closure
# Unimplemented functions should be marked as unavailable.
- unavailable_function
# Parentheses are not needed when declaring closure arguments.
- unneeded_parentheses_in_closure_argument
# Unused control flow label should be removed.
- unused_control_flow_label
# Setter value is not used.
- unused_setter_value
# Function parameters should be aligned vertically if they're in multiple lines in a method call.
- vertical_parameter_alignment_on_call
# Include a single empty line between switch cases.
- vertical_whitespace_between_cases
# Don't include vertical whitespace (empty line) before closing braces.
- vertical_whitespace_closing_braces
# An XCTFail call should include a description of the assertion.
- xctfail_message
# Prefer specific XCTest matchers over `XCTAssertEqual` and `XCTAssertNotEqual`.
- xct_specific_matcher
# The variable should be placed on the left, the constant on the right of a comparison operator.
- yoda_condition
disabled_rules:
# Files should not span too many lines.
- file_length
# TODOs and FIXMEs should be resolved.
- todo
# Type bodies should not span too many lines.
- type_body_length
excluded:
- .ci/
- Pods/
- MSDKUI/Classes/Style.swift
- MSDKUI_Demo_UI_Tests/EarlGrey.swift
- MSDKUI_Demo/NMACredentials.swift
- vendor/
- Documentation/
- output/
force_unwrapping:
severity: error
identifier_name:
min_length:
error: 3
max_length: 60
excluded:
- id
- at
- to
line_length:
warning: 160
error: 200
ignores_comments: true
nesting:
type_level: 2
type_name:
min_length: 3
max_length:
warning: 50
error: 60
function_body_length:
warning: 100
error: 150
private_outlet:
allow_private_set: true
file_header:
required_pattern: |
\/\/
\/\/ Copyright \(C\) 2017-2021 HERE Europe B\.V\.
\/\/
\/\/ Licensed under the Apache License, Version 2\.0 \(the "License"\);
\/\/ you may not use this file except in compliance with the License\.
\/\/ You may obtain a copy of the License at
\/\/
\/\/ http:\/\/www\.apache\.org\/licenses\/LICENSE-2\.0
\/\/
\/\/ Unless required by applicable law or agreed to in writing, software
\/\/ distributed under the License is distributed on an "AS IS" BASIS,
\/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
\/\/ See the License for the specific language governing permissions and
\/\/ limitations under the License\.
\/\/
custom_rules:
localized_string:
excluded: "MSDKUI/Classes/ExtensionString.swift|MSDKUI_Tests/TestUtils.swift|MSDKUI_Demo/ExtensionString.swift|Commons_Tests/Extensions/ExtensionXCTestCase.swift"
name: "Localized String"
regex: "NSLocalizedString(.*[^,], comment: .*[^)])"
message: "Please use .localized instead"
severity: warning
todo_jira:
name: "TODO JIRA"
regex: 'TODO: (?!MSDKUI).+'
message: "TODO must have a JIRA ticket following the format '// TODO: MSDKUI-XYZ ...'"
severity: warning
comments_space:
name: "Blank Space After Comment"
regex: '(^ *//\w+)'
message: "Please leave a blank space after //"
severity: warning
empty_line_after_super:
name: "Empty Line After Super"
regex: '(^ *super\.[ a-zA-Z0-9=?.\(\)\{\}:,><!]*\n *(?!(?:\}|return))\S+)'
message: "Please leave an empty line after calling super"
severity: warning