-
Notifications
You must be signed in to change notification settings - Fork 52
/
.swiftlint.yml
149 lines (144 loc) · 4.79 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
disabled_rules:
- identifier_name # Does not make sense to lint for the length of identifiers.
- type_name # Same as above.
- empty_enum_arguments # It warns about an explicit pattern we use.
- superfluous_disable_command # Disabled since we disable some rules pre-emptively to avoid issues in the future
- todo # Temporarily disabled. We have too many right now hiding real issues :(
- nesting # Does not make sense anymore since Swift 4 uses nested `CodingKeys` enums for example
opt_in_rules:
- anyobject_protocol
- attributes
- closure_end_indentation
- closure_spacing
- collection_alignment
- colon
- contains_over_filter_count
- contains_over_filter_is_empty
- contains_over_first_not_nil
- discouraged_object_literal
- empty_collection_literal
- empty_count
- empty_string
- explicit_init
- extension_access_modifier
- fatal_error_message
- file_header
- first_where
- identical_operands
- implicit_return
- inert_defer
- joined_default_parameter
- literal_expression_end_indentation
- legacy_hashing
- legacy_random
- multiline_arguments
- multiline_literal_brackets
- multiline_parameters
- multiline_parameters_brackets
- notification_center_detachment
- number_separator
- operator_usage_whitespace
- overridden_super_call
- private_action
- prohibited_interface_builder
- prohibited_super_call
- redundant_nil_coalescing
- redundant_objc_attribute
- single_test_class
- sorted_imports
- static_operator
- toggle_bool
- trailing_comma
- trailing_whitespace
- unneeded_parentheses_in_closure_argument
- vertical_parameter_alignment_on_call
- yoda_condition
excluded:
- .github/
- .build/
- build/
- Carthage/
- docs/
- fastlane/
- DerivedData/
- e2eTests/XCRemoteCacheSample/Pods
- e2eTests/StandaloneSampleApp
attributes:
always_on_same_line:
- "@IBAction"
- "@NSManaged"
- "@objc"
closure_spacing: warning
empty_count:
severity: warning
implicit_return:
included:
- closure
explicit_init: warning
fatal_error_message: warning
file_header:
severity: warning
forbidden_pattern: |
\/\/
\/\/ .*?\..*
\/\/ .*
\/\/
\/\/ Created by .*? on .*\.
\/\/ Copyright © \d{4} .*\. All rights reserved\.
\/\/
required_pattern: |
\/\/ Copyright \(c\) \d{4} Spotify AB\.
\/\/
\/\/ Licensed to the Apache Software Foundation \(ASF\) under one
\/\/ or more contributor license agreements\. See the NOTICE file
\/\/ distributed with this work for additional information
\/\/ regarding copyright ownership\. The ASF licenses this file
\/\/ to you 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\.
force_cast: warning
force_try: warning
implicit_getter: warning
indentation: 4 # 4 spaces
line_length:
warning: 120
error: 200
ignores_function_declarations: true
multiline_arguments:
first_argument_location: next_line
number_separator:
minimum_length: 5 # number of digits, i.e. >= 10_000
redundant_nil_coalescing: warning
shorthand_operator: warning
trailing_comma:
mandatory_comma: true
vertical_whitespace:
max_empty_lines: 2
weak_delegate: warning
cyclomatic_complexity:
warning: 12
function_parameter_count:
warning: 7
reporter:
- "xcode"
- "junit"
custom_rules:
associated_values_unwrapping:
name: "Associated Value Unwrapping"
regex: "case let [a-zA-Z0-9]*.[a-zA-Z0-9]+\\([a-zA-Z0-9 ,]+"
message: "Each associated value should be defined as a separate constant (i.e: .enumCase(let val1, let val2))"
severity: warning
trailing_dot_in_comments:
name: "Trailing dot in comments"
regex: '^(?!\/\/\ Copyright\ \(c\)\ \d{4}\ Spotify AB\.|\/\/\ under\ the\ License\.)[ ]*///?[^\n]*\.\n'
message: "There shouldn't be trailing dot in comments"
severity: warning