-
Notifications
You must be signed in to change notification settings - Fork 113
/
.swiftlint.yml
181 lines (161 loc) · 3.63 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
#
# SwiftLint configuration file
#
# Feel free to send pull request or suggest improvements!
#
#
# Rule identifiers to exclude from running.
#
disabled_rules:
- modifier_order
- statement_position
- todo
- blanket_disable_command
# - trailing_whitespace
#
# Some rules are only opt-in. Find all the available rules by running: swiftlint rules
#
opt_in_rules:
- anyobject_protocol
- array_init
- attributes
- closure_end_indentation
- closure_spacing
- collection_alignment
- conditional_returns_on_newline
- contains_over_first_not_nil
- convenience_type
- discouraged_object_literal
- empty_count
- empty_string
- empty_xctest_method
# - explicit_acl
# - explicit_enum_raw_value
- explicit_init
- extension_access_modifier
- fallthrough
- fatal_error_message
# - file_name
- first_where
- force_unwrapping
# - function_default_parameter_at_end
- identical_operands
- implicitly_unwrapped_optional
#- implicit_return
- last_where
- legacy_multiple
- legacy_random
- literal_expression_end_indentation
- lower_acl_than_parent
- missing_docs
- modifier_order
- multiline_arguments
- multiline_function_chains
- multiline_literal_brackets
- multiline_parameters
- multiline_parameters_brackets
# - number_separator
- operator_usage_whitespace
- pattern_matching_keywords
- private_action
- private_outlet
- reduce_into
- redundant_nil_coalescing
- redundant_type_annotation
- required_enum_case
- single_test_class
- sorted_first_last
- static_operator
- strict_fileprivate
- switch_case_on_newline
- toggle_bool
# - trailing_closure
- unavailable_function
- unneeded_parentheses_in_closure_argument
- unowned_variable_capture
- untyped_error_in_catch
- unused_import
- unused_declaration
- vertical_parameter_alignment_on_call
- vertical_whitespace_closing_braces
- yoda_condition
# TODO: Enable once these rules are no longer experimental
# analyzer_rules:
# - explicit_self
#
# Paths to include during linting. `--path` is ignored if present.
#
included:
- Sources
#
# Paths to ignore during linting. Takes precedence over `included`.
#
excluded:
- Carthage
- Pods
- Tests
- Vendor
- Scripts
- fastlane
- R.generated.swift
- Package.swift
#
# Configure individual rules below.
#
vertical_whitespace:
max_empty_lines: 2
force_cast: error
identifier_name:
excluded:
- id
- by
trailing_whitespace:
ignores_empty_lines: no
line_length:
ignores_function_declarations: yes
ignores_comments: yes
ignores_urls: yes
line_length:
error: 300
warning: 200
function_body_length:
error: 150
warning: 100
type_body_length:
error: 900
warning: 600
file_length:
error: 1000
warning: 700
function_parameter_count:
error: 9
warning: 8
required_enum_case:
BoxEnum:
customValue: error
# Custom rules definitions
custom_rules:
comments_space: # From https://github.com/brandenr/swiftlintconfig
name: "Space After Comment"
regex: "(^ *//\\w+)"
message: "There should be a space after //"
severity: warning
force_https: # From https://github.com/Twigz/Game
name: "Force HTTPS over HTTP"
regex: "((?i)http(?!s))"
match_kinds: string
message: "HTTPS should be favored over HTTP"
severity: warning
double_space: # From https://github.com/IBM-Swift/Package-Builder
include: "*.swift"
name: "Double space"
regex: "([a-z,A-Z] \\s+)"
message: "Double space between keywords"
match_kinds: keyword
severity: warning
unused_param:
include: "*.swift"
name: "Unused Parameter"
regex: "_\\s*:"
message: "Unused method parameter"
severity: error