1
1
# Basic Configuration
2
2
opt_in_rules :
3
+ - anyobject_protocol
3
4
- array_init
4
5
- attributes
5
6
- closure_end_indentation
6
7
- closure_spacing
8
+ - collection_alignment
7
9
- conditional_returns_on_newline
10
+ - contains_over_filter_count
11
+ - contains_over_filter_is_empty
8
12
- contains_over_first_not_nil
13
+ - contains_over_range_nil_comparison
9
14
- convenience_type
15
+ - empty_collection_literal
10
16
- empty_count
11
17
- empty_string
12
18
- empty_xctest_method
@@ -16,65 +22,75 @@ opt_in_rules:
16
22
- fatal_error_message
17
23
- file_header
18
24
- file_name
25
+ - file_name_no_space
19
26
- file_types_order
20
27
- first_where
28
+ - flatmap_over_map_reduce
21
29
- function_default_parameter_at_end
30
+ - identical_operands
31
+ - implicit_return
22
32
- implicitly_unwrapped_optional
23
- - is_disjoint
33
+ - indentation_width
24
34
- joined_default_parameter
35
+ - last_where
36
+ - legacy_multiple
37
+ - legacy_random
25
38
- let_var_whitespace
26
39
- literal_expression_end_indentation
27
40
- lower_acl_than_parent
28
41
- missing_docs
29
42
- modifier_order
30
43
- multiline_arguments
31
44
- multiline_arguments_brackets
32
- - multiline_function_chains
33
45
- multiline_literal_brackets
34
46
- multiline_parameters
35
47
- multiline_parameters_brackets
36
- - nimble_operator
48
+ - nslocalizedstring_key
37
49
- number_separator
38
50
- object_literal
39
51
- operator_usage_whitespace
52
+ - optional_enum_case_matching
40
53
- overridden_super_call
41
54
- override_in_extension
42
55
- pattern_matching_keywords
56
+ - prefer_self_type_over_type_of_self
43
57
- private_action
44
58
- private_outlet
45
59
- prohibited_super_call
46
- - quick_discouraged_call
47
- - quick_discouraged_focused_test
48
- - quick_discouraged_pending_test
60
+ - reduce_into
49
61
- redundant_nil_coalescing
50
62
- redundant_type_annotation
51
63
- single_test_class
52
64
- sorted_first_last
53
65
- sorted_imports
66
+ - static_operator
67
+ - strong_iboutlet
54
68
- switch_case_on_newline
69
+ - toggle_bool
55
70
- trailing_closure
56
71
- type_contents_order
57
72
- unavailable_function
58
73
- unneeded_parentheses_in_closure_argument
59
74
- untyped_error_in_catch
75
+ - unused_declaration
76
+ - unused_import
60
77
- vertical_parameter_alignment_on_call
61
78
- vertical_whitespace_between_cases
62
79
- vertical_whitespace_closing_braces
63
80
- vertical_whitespace_opening_braces
81
+ - xct_specific_matcher
64
82
- yoda_condition
65
83
66
- disabled_rules :
67
- - force_cast
68
- - todo
69
- - type_name
70
-
71
84
included :
72
- - Frameworks
85
+ - Sources
73
86
- Tests
74
87
75
88
excluded :
76
89
- Tests/LinuxMain.swift
77
90
91
+ disabled_rules :
92
+ - todo
93
+
78
94
# Rule Configurations
79
95
conditional_returns_on_newline :
80
96
if_only : true
@@ -85,41 +101,28 @@ explicit_type_interface:
85
101
- local
86
102
87
103
file_header :
88
- required_pattern : |
89
- \/\/
90
- \/\/ Created by [^\(\)\d\n]+ on \S{6,10}\.
91
- \/\/ Copyright © \d{4} Flinesoft\. All rights reserved\.
92
- \/\/
104
+ required_pattern : \/\/ Copyright © \d{4} Flinesoft\. All rights reserved\.
93
105
94
106
file_name :
95
- suffix_pattern : " Extensions?|\\ +.*"
96
-
97
- file_types_order :
98
- order :
99
- - supporting_type
100
- - main_type
101
- - extension
107
+ suffix_pattern : " Ext"
102
108
103
109
identifier_name :
110
+ max_length : 60
104
111
excluded :
105
112
- id
113
+ - db
114
+ - to
106
115
107
116
line_length : 160
108
117
109
- type_contents_order :
110
- order :
111
- - case
112
- - [type_alias, associated_type]
113
- - subtype
114
- - type_property
115
- - instance_property
116
- - ib_outlet
117
- - initializer
118
- - type_method
119
- - view_life_cycle_method
120
- - ib_action
121
- - other_method
122
- - subscript
118
+ nesting :
119
+ type_level : 3
120
+
121
+ trailing_comma :
122
+ mandatory_comma : true
123
+
124
+ trailing_whitespace :
125
+ ignores_comments : false
123
126
124
127
# Custom Rules
125
128
custom_rules :
@@ -141,15 +144,9 @@ custom_rules:
141
144
name : " Class Name Suffix View Controller"
142
145
message : " All `ViewController` subclasses should end on `ViewController`."
143
146
severity : warning
144
- closing_brace_whitespace :
145
- included : " .*.swift"
146
- regex : ' (?:\n| {2,})\}\)? *\n *[^ \n\})\]s#"]'
147
- name : " Closing Brace Whitespace"
148
- message : " Empty line required after closing curly braces if code with same indentation follows."
149
- severity : warning
150
147
closure_params_parantheses :
151
148
included : " .*.swift"
152
- regex : ' \{\s*\([^):]+\)\s*in'
149
+ regex : ' \{\s*\((?!self) [^):]+\)\s*in'
153
150
name : " Unnecessary Closure Params Parantheses"
154
151
message : " Don't use parantheses around non-typed parameters in a closure."
155
152
severity : warning
@@ -173,9 +170,9 @@ custom_rules:
173
170
severity : warning
174
171
controller_class_name_suffix :
175
172
included : " .*.swift"
176
- regex : ' class +\w+(?<!View|Flow)Controller'
173
+ regex : ' class +\w+(?<!Navigation| View|Flow|Model )Controller'
177
174
name : " Controller Class Name Suffix"
178
- message : " Only use the `Controller` class name suffix for ViewControllers or FlowControllers."
175
+ message : " Only use the `Controller` class name suffix for Navigation-, View-, Model- or FlowControllers."
179
176
severity : warning
180
177
debug_log_level :
181
178
included : " .*.swift"
@@ -195,6 +192,12 @@ custom_rules:
195
192
name : " Empty Method"
196
193
message : " Don't keep empty methods in code without commenting inside why they are needed or a `// TODO: not yet implemented`."
197
194
severity : warning
195
+ empty_todo :
196
+ included : " .*.swift"
197
+ regex : ' \/\/ TODO: (\[[\d-]+\])? *\n'
198
+ name : " Empty Todo"
199
+ message : " `// TODO:` comments should not be empty."
200
+ severity : warning
198
201
empty_type :
199
202
included : " .*.swift"
200
203
regex : ' (?:class|protocol|struct|enum) [^\{]+\{\s*\}'
@@ -249,6 +252,18 @@ custom_rules:
249
252
name : " Logging Prefix"
250
253
message : " Don't use logging prefixes with log.verbose/debug/info/warning/error – done automatically."
251
254
severity : warning
255
+ multiline_guard_end :
256
+ included : " .*.swift"
257
+ regex : ' guard\s*([^\n]*,\n)+([^\n]*\S *)else\s*\{'
258
+ name : " Multiline Guard End"
259
+ message : " Always close a multiline guard via `else {` on a new line indented like the opening `guard`."
260
+ severity : warning
261
+ multiline_guard_start :
262
+ included : " .*.swift"
263
+ regex : ' guard([^\n]*,\n)+[^\n]*else\s*\{'
264
+ name : " Multiline Guard Start"
265
+ message : " Always start a multiline guard via `guard` then a line break and all expressions indented."
266
+ severity : warning
252
267
multiple_closure_params :
253
268
included : " .*.swift"
254
269
regex : ' \n *(?:[^\.\n=]+\.)+[^\(\s]+\([^\{\n]+\{[^\}\n]+\}\)\s*\{'
@@ -261,30 +276,12 @@ custom_rules:
261
276
name : " Non Case Enum"
262
277
message : " Do not call enum cases `none` as you might run into problems with Optionals of this type."
263
278
severity : warning
264
- quick_temporary_disabling :
265
- included : " .*.swift"
266
- regex : ' \sxdescribe\(|\sxcontext\(|\sxit\('
267
- name : " Quick Temporary Disabling"
268
- message : " Temporary disabled Quick examples or groups shouldn't be commited."
269
- severity : warning
270
- quick_temporary_focus :
271
- included : " .*.swift"
272
- regex : ' \sfdescribe\(|\sfcontext\(|\sfit\('
273
- name : " Quick Temporary Focus"
274
- message : " Temporary focused Quick examples or groups shouldn't be commited."
275
- severity : warning
276
279
remove_where_for_negative_filtering :
277
280
included : " .*.swift"
278
281
regex : ' \.filter *\{ *!\$0\.[^\}&|]+\}'
279
282
name : " Remove Where for Negative Filtering"
280
283
message : " Use `remove(where:)` instead of `filter(where not ...)` for performance."
281
284
severity : warning
282
- single_line_enum_cases :
283
- included : " .*.swift"
284
- regex : ' enum [^\{]+\{\s*(?:\s*\/\/[^\n]*)*\s*case\s+[^,(\n]+,'
285
- name : " Single Line Enum Cases"
286
- message : " Use a new line for each enum case."
287
- severity : warning
288
285
single_line_guard :
289
286
included : " .*.swift"
290
287
regex : ' guard[^\{]{2,80}else\s*\{\s*\n\s*return.{2,40}\}'
@@ -321,23 +318,23 @@ custom_rules:
321
318
name : " Switch Associated Value Style"
322
319
message : " Always put the `let` in front of case – even if only one associated value captured."
323
320
severity : warning
324
- toggle_bool :
321
+ todo_format :
325
322
included : " .*.swift"
326
- regex : ' (?<=\n)[ \t]*(?<VAR>\w+) *= *!\k<VAR>(?=\s) '
327
- name : " Toggle Bool "
328
- message : " Use `toggle()` instead of toggling manually ."
323
+ regex : ' \/\/ TODO: [^\n]{0,14}\n|\/\/ TODO: \[\S{1,12}\]|\/\/ TODO: [^\[]|\/\/ TODO: \[.{13}[^\]]|\/\/ TODO: \[[^a-z]{2}|\/\/ TODO: \[.{2}[^_]|\/\/ TODO: \[.{7}[^-]|\/\/ TODO: \[.{10}[^-] '
324
+ name : " Todo Date "
325
+ message : " All TODOs should have a format with creator credentials & date of their creation documented like this: `// TODO: [cg_YYYY-MM-DD] ` ."
329
326
severity : warning
330
- too_much_indentation :
327
+ todo_uppercase :
331
328
included : " .*.swift"
332
- regex : ' \n {0}[^\s\/][^\n]*[^,|&]\n+ {5,}\S|\n {4}[^\s\/][^\n]*[^,|&]\n+ {9,}\S|\n {8}[^\s\/][^\n]*[^,|&]\n+ {13,}\S|\n {12}[^\s\/][^\n]*[^,|&]\n+ {17,}\S|\n {16}[^\s\/][^\n]*[^,|&]\n+ {21,}\S|\n {20}[^\s\/][^\n]*[^,|&]\n+ {25,}\S '
333
- name : " Too Much Indentation "
334
- message : " Don't indent code by more than 4 whitespaces ."
329
+ regex : ' \/\/ ?tODO|\/\/ ?ToDO|\/\/ ?TOdO|\/\/ ?TODo|\/\/ ?todo|\/\/ ?Todo|\/\/ ?ToDo|\/\/ ?toDo '
330
+ name : " Todo Uppercase "
331
+ message : " All TODOs should be all-uppercased like this: `// TODO: [cg_YYYY-MM-DD] ` ."
335
332
severity : warning
336
- too_much_unindentation :
333
+ todo_whitespacing :
337
334
included : " .*.swift"
338
- regex : ' {28}[^\s\.](.|[^\n]*[^\)][^\ ][^\}])\n+ {0,23}[^\s\/]| {24}[^\s\.](.|[^\n]*[^\)][^\ ][^\}])\n+ {0,19}[^\s\/]| {20}[^\s\.](.|[^\n]*[^\)][^\ ][^\}])\n+ {0,15}[^\s\/]| {16}[^\s\.](.|[^\n]*[^\)][^\ ][^\}])\n+ {0,11}[^\s\/]| {12}[ ^\s\.](.|[^\n]*[^\)][^\ ][^\}])\n+ {0,7}[^\s\/]| {8}[^\s\.](.|[^\n]*[^\)][^\ ][^\}])\n+ {0,3}[^\s\/ ]'
339
- name : " Too Much Unindentation "
340
- message : " Don't unindent code by more than 4 whitespaces ."
335
+ regex : ' \/\/TODO|\/\/ TODO\s|\/\/ TODO:[^ ]|\/\/ TODO: |\/\/ TODO: \[[ ^\s] {0,10}\][^ ]'
336
+ name : " Todo Whitespace "
337
+ message : " All TODOs should exactly start like this (mind the whitespacing): `// TODO: [cg_YYYY-MM-DD] ` ."
341
338
severity : warning
342
339
tuple_index :
343
340
included : " .*.swift"
0 commit comments