-
-
Notifications
You must be signed in to change notification settings - Fork 414
Expand file tree
/
Copy path.swiftlint.yml
More file actions
executable file
·161 lines (155 loc) · 4.58 KB
/
Copy path.swiftlint.yml
File metadata and controls
executable file
·161 lines (155 loc) · 4.58 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
excluded:
- Pods
- DerivedData
- "**/SourcePackages/**"
- "**/build/**"
- DependencyManagerTests
- Sources/SentryCrash
- vendor
- Tests/Perf
- SentryTestUtils/Dynamic/**
- .build/**
- "**/.build/**"
- .git/**
- XCFrameworkBuildPath/**
- 3rd-party-integrations/**/Packages/sentry-cocoa
# Exclude auto-generated files from sample app builds
- "**/Build/Intermediates.noindex/iOS-Swift.build/**/DerivedSources/**"
- "**/Build/Intermediates.noindex/iOS-SwiftClip.build/**/DerivedSources/**"
- "**/worktree/**"
- "**/worktrees/**"
only_rules:
- class_delegate_protocol
- closing_brace
- closure_end_indentation
- closure_parameter_position
- closure_spacing
- colon
- comma
- compiler_protocol_init
- control_statement
- custom_rules
- cyclomatic_complexity
- dynamic_inline
- empty_parameters
- empty_parentheses_with_trailing_closure
- explicit_init
- file_length
- first_where
- force_cast
- force_try
- force_unwrapping
- function_body_length
- function_name_whitespace
- generic_type_name
- implicit_getter
- large_tuple
- leading_whitespace
- legacy_cggeometry_functions
- legacy_constant
- legacy_constructor
- legacy_nsgeometry_functions
- line_length
- mark
- missing_docs
- nimble_operator
- number_separator
- opening_brace
- operator_usage_whitespace
- overridden_super_call
- private_outlet
- private_unit_test
- prohibited_super_call
- redundant_nil_coalescing
- implicit_optional_initialization
- redundant_string_enum_value
- redundant_void_return
- return_arrow_whitespace
- shorthand_operator
- sorted_imports
- statement_position
- syntactic_sugar
- todo
- trailing_comma
- trailing_newline
- trailing_semicolon
- type_body_length
- type_name
- unused_closure_parameter
- unused_enumerated
- unused_optional_binding
- valid_ibinspectable
- identifier_name
- vertical_parameter_alignment
- vertical_whitespace
- void_return
- weak_delegate
- yoda_condition
- non_optional_string_data_conversion
identifier_name:
allowed_symbols:
- i
- _
min_length:
- 1
max_length:
warning: 50
error: 50
line_length:
- 1000
type_name:
min_length:
- 2
- 1
max_length:
warning: 60
error: 60
large_tuple:
- 3
missing_docs:
warning: [open, public]
evaluate_effective_access_control_level: true
excludes_extensions: false
excludes_inherited_types: false
excludes_trivial_init: false
severity: error
sorted_imports:
grouping:
attributes
custom_rules:
no_try_optional_in_tests:
name: "No try? in tests"
message: "Avoid `try?` in tests. Use `try XCTUnwrap(...)` instead."
regex: 'try\?'
severity: error
included:
- "./Tests/.*\\.swift"
avoid_all_header_fields:
name: "Careful with allHeaderFields"
message: "Double-check how you use allHeaderFields / allHTTPHeaderFields (https://developer.apple.com/documentation/foundation/httpurlresponse/allheaderfields). Reading all headers is fine, but their subscript is case-sensitive while HTTP/2 and HTTP/3 lowercase field names, so a single-header lookup can silently miss the header (see #8322). For a lookup, use value(forHTTPHeaderField:) or the HTTPURLResponse.value(forHTTPHeaderFieldCaseInsensitive:) extension in HTTPURLResponse+Sentry.swift. If your usage is intentional, suppress this rule with a comment explaining why."
regex: "all(HTTP)?HeaderFields"
match_kinds:
- identifier
severity: error
included:
- "./Sources/.*\\.swift"
avoid_direct_associated_object_access:
name: "Avoid direct associated object access"
message: "Use AssociatedObjectAccessor instead of calling the Objective-C associated object APIs directly."
regex: "objc_(get|set)AssociatedObject"
match_kinds:
- identifier
severity: error
excluded:
- "./Sources/Swift/Core/Helper/AssociatedObjectAccessor.swift"
- "./Tests/.*\\.swift"
no_implementation_only_import:
name: "No @_implementationOnly import"
message: "Use `internal import` (SE-0409) instead of `@_implementationOnly import`."
regex: "@_implementationOnly import"
severity: error
no_breadcrumb_data_setter:
name: "Avoid the Breadcrumb.data setter"
message: "Use `setData(value:key:)` instead of assigning the whole `Breadcrumb.data` dictionary. Assigning a bridged Swift dictionary can crash (see #7861); the `data` setter will become read-only in a future release. If you must assign a whole dictionary, suppress this rule with a comment explaining why."
regex: '(crumb|breadcrumb|wrapped)\.data\s*=(?!=)'
severity: error