-
-
Notifications
You must be signed in to change notification settings - Fork 412
Expand file tree
/
Copy path.swiftlint.yml
More file actions
201 lines (181 loc) · 4.78 KB
/
Copy path.swiftlint.yml
File metadata and controls
201 lines (181 loc) · 4.78 KB
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
# SwiftLint configuration
# https://github.com/realm/SwiftLint
# Paths to include during linting
included:
- TablePro
- Packages
# Paths to exclude during linting.
# `.build` has to be globbed: SwiftLint resolves an `excluded:` entry against this file's own
# directory, so a bare `.build` misses `Packages/*/.build`, and linting a resolved dependency's
# checkout reports tens of thousands of violations in code nobody here wrote.
excluded:
- DerivedData
- "**/.build"
- Pods
- Carthage
- vendor
# Enabled rules (beyond default)
opt_in_rules:
- closure_end_indentation
- collection_alignment
- contains_over_filter_count
- contains_over_filter_is_empty
- contains_over_first_not_nil
- discouraged_object_literal
- empty_collection_literal
- empty_count
- explicit_init
- extension_access_modifier
- fallthrough
- fatal_error_message
- file_header
- file_name_no_space
- first_where
- flatmap_over_map_reduce
- force_unwrapping
- identical_operands
- implicit_return
- joined_default_parameter
- last_where
- legacy_random
- literal_expression_end_indentation
- lower_acl_than_parent
- modifier_order
- nimble_operator
- nslocalizedstring_key
- number_separator
- object_literal
- operator_usage_whitespace
- overridden_super_call
- prefer_self_type_over_type_of_self
- prefer_zero_over_explicit_init
- private_action
- private_outlet
- prohibited_super_call
- quick_discouraged_call
- quick_discouraged_focused_test
- quick_discouraged_pending_test
- reduce_into
- redundant_type_annotation
- required_enum_case
- single_test_class
- sorted_first_last
- sorted_imports
- static_operator
- strong_iboutlet
- toggle_bool
- unneeded_parentheses_in_closure_argument
- unowned_variable_capture
- vertical_parameter_alignment_on_call
- vertical_whitespace_closing_braces
- vertical_whitespace_opening_braces
- xct_specific_matcher
- yoda_condition
# Disabled rules
disabled_rules:
- trailing_comma
- todo
- opening_brace
- trailing_closure
- closure_spacing
- multiple_closures_with_trailing_closure
- for_where
- redundant_string_enum_value
- is_disjoint
- static_over_final_class
- force_try
# Rule configurations
line_length:
warning: 180
error: 300
ignores_urls: true
ignores_function_declarations: true
ignores_comments: true
ignores_interpolated_strings: true
type_body_length:
warning: 1100
error: 1500
file_length:
warning: 1200
error: 1800
ignore_comment_only_lines: true
function_body_length:
warning: 160
error: 250
function_parameter_count:
warning: 10
error: 15
type_name:
min_length: 2
max_length: 50
identifier_name:
min_length:
warning: 1
error: 0
max_length:
warning: 80
error: 100
validates_start_with_lowercase: error
excluded:
- id
- x
- y
- i
- j
- k
- db
- to
- at
- by
- up
- on
- xc
- uc
- lc
- TableProDir
- SQLITE_TRANSIENT
- protocol_tcp
- where_
- TableProTabSmart
- x86_64
nesting:
type_level:
warning: 3
function_level:
warning: 5
cyclomatic_complexity:
warning: 40
error: 60
ignores_case_statements: true
large_tuple:
warning: 4
error: 5
vertical_whitespace:
max_empty_lines: 2
force_cast: warning
force_unwrapping: warning
trailing_whitespace:
ignores_empty_lines: true
ignores_comments: true
colon:
apply_to_dictionaries: true
comma: warning
# No print statements is now disabled - use Logger in the future
custom_rules:
storage_environment_directory:
name: "Storage Environment Directory"
regex: 'applicationSupportDirectory'
excluded: ".*/AppStorageEnvironment\\.swift"
message: "Resolve the directory through AppStorageEnvironment.shared, or a UI test writes to the developer's own store."
severity: error
storage_environment_defaults:
name: "Storage Environment Defaults"
regex: 'UserDefaults\.standard'
excluded: ".*/(AppStorageEnvironment|GeneralSettings|SoftwareUpdater|WorkspaceRailViewController|SplitViewAutosaveSweep)\\.swift"
message: "Resolve preferences through AppStorageEnvironment.shared.defaults. Only a macOS-owned system preference reads the standard domain."
severity: error
public_error_text_in_log:
name: "Error Text In The System Log"
regex: '(\.(localizedDescription|errorDescription|failureReason)(\.prefix\(\d+\))?(\s*\?\?\s*"[^"]*")?|String\(describing:\s*\w*[eE]rr(or)?\)|\\\((?!(has|is|did|was|should)[A-Z])(\w*[eE]rr(or)?|e)(\.(message|description|debugDescription))?)\s*,\s*privacy:\s*\.public'
message: "A driver or Foundation error's text carries row values, paths and server messages. Publish `error.publicLogShape`, or `LogRedaction.publicDescription(of: error)` in a plugin, and log the description at .private."
severity: error