This repository has been archived by the owner on Nov 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
.swiftlint.yml
143 lines (131 loc) · 4.25 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
disabled_rules:
- closure_parameter_position
- cyclomatic_complexity
- file_length
- force_cast
- function_body_length
- nesting
- todo
- type_body_length
- for_where
- no_fallthrough_only
# All the following Handled by SwiftFormat.
- closure_end_indentation
- closure_spacing
- explicit_init
- literal_expression_end_indentation
- operator_usage_whitespace
- private_over_fileprivate
- redundant_void_return
- return_arrow_whitespace
- trailing_comma
- vertical_parameter_alignment
- vertical_parameter_alignment_on_call
- vertical_whitespace
- implicit_return
- inclusive_language
opt_in_rules:
- array_init
- block_based_kvo
- contains_over_filter_count
- contains_over_filter_is_empty
- contains_over_first_not_nil
- contains_over_range_nil_comparison
- discouraged_direct_init
- duplicate_imports
- empty_collection_literal
- empty_count
- empty_string
- empty_xctest_method
- extension_access_modifier
- fatal_error_message
- first_where
- flatmap_over_map_reduce
- force_unwrapping
- identical_operands
- implicitly_unwrapped_optional
- joined_default_parameter
- multiline_parameters
- multiple_closures_with_trailing_closure
- nimble_operator
- overridden_super_call
- prefer_self_type_over_type_of_self
- private_unit_test
- prohibited_super_call
- protocol_property_accessors_order
- redundant_nil_coalescing
- redundant_set_access_control
- unneeded_parentheses_in_closure_argument
- weak_delegate
analyzer_rules:
- unused_import
- unused_declaration
indentation: 4
weak_delegate: error
function_parameter_count:
warning: 8
error: 8
large_tuple:
warning: 3
error: 3
identifier_name:
min_length: 0
max_length: 42
allowed_symbols:
- tt_
type_name:
max_length: 52
line_length: 200
included:
- Thumbprint
custom_rules:
discourage_unowned:
name: "Unowned"
regex: "(unowned)"
message: "Please use `weak` instead."
severity: error
weak_self_binding:
name: "Weak Self Binding"
regex: '(let\s+(?!self)\w+\s*=\s*self[,\s](?!as\?))'
message: "use `let self = self` instead. "
severity: error
todo_format:
name: "TODO Format"
regex: '(//\s?(TODO|FIXME)\s*[^:]|//\s?(TODO|FIXME):?\s*\w)'
message: "TODO items should use the format, e.g // TODO: (ileitch) fix this!"
severity: error
file_header:
name: "File Header"
regex: "^// Created by"
message: "Remove Xcode generated file headers"
severity: error
notification_name_extension:
name: "Notification.Name Extension"
regex: 'extension Notification\.Name \{'
message: 'Extending Notification.Name is no longer idiomatic. Instead, use static properties on your class with type Notification.Name, e.g static let myNotification = Notification.Name(rawValue: "MyNotification")'
severity: error
default_frame_parameter:
name: "Default Frame Parameter"
regex: '(?<!(super|self)\.init\()frame: (CGRect)?.zero(?!,)'
message: "Omit frame in constructor (or use .null if a frame is required) when there is no need to initialize this view with a specific frame."
severity: error
prefer_remove_from_superview:
name: "Prefer removeFromSuperview over removeArrangedSubview"
regex: "removeArrangedSubview"
message: "Only calling removeArrangedSubview() will leave the view in `subviews` and therefore in the view hierarchy. Since removeFromSuperview() will remove the view from the arrangedSubviews, per the docs, there should never be a need for removeArrangedSubview()."
disallow_uiwindow_instantiation:
included: '.*/Tests/Snapshot/.*\.swift'
name: "Disallow UIWindow Instantiation"
regex: 'UIWindow\('
message: "Do not instantiate UIWindow directly, use the verify(viewController:) helper instead."
severity: error
disallow_snapshot_testing_direct_usage:
included: '.*/Tests/Snapshot/.*\.swift'
name: "Disallow SnapshotTesting Direct Usage"
regex: "import SnapshotTesting"
message: "Please use the verify() helpers provided by SnapshotTestCase."
severity: error
no_literal_nbsp:
name: "No literal non-breaking spaces"
regex: '\N{NO-BREAK SPACE}'
message: "To avoid confusing invisible differences in strings, use the Swift Unicode escape \\u{a0} instead of literal non-breaking spaces."