forked from djud17-org/todoList
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.swiftlint.yml
179 lines (161 loc) · 4.86 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
# https://bitbucket.app.local/projects/ITD/repos/swift-style-guide/browse/swiftlint.yml
# https://github.com/realm/SwiftLint
# список правил, которые необходимо включить (по умолчанию отключены)
opt_in_rules:
- anyobject_protocol
- closure_body_length
- closure_end_indentation
- closure_spacing
- collection_alignment
- convenience_type
- explicit_init
- empty_count
- fatal_error_message
- first_where
- force_unwrapping
- implicitly_unwrapped_optional
- joined_default_parameter
- lower_acl_than_parent
- missing_docs
- modifier_order
- multiline_arguments
- multiline_arguments_brackets
- multiline_function_chains
- multiline_literal_brackets
- multiline_parameters
- multiline_parameters_brackets
- operator_usage_whitespace
- overridden_super_call
- private_action
- private_outlet
- prohibited_super_call
- redundant_type_annotation
- switch_case_on_newline
- trailing_closure
- unneeded_parentheses_in_closure_argument
- untyped_error_in_catch
- vertical_parameter_alignment_on_call
- vertical_whitespace_closing_braces
# путь к исходникам для проверки кода
included:
- taskManager
# подкаталоги, в которых линтер не будет делать проверку кода
excluded:
- Carthage
- Pods
# список правил для анализа `swiftlint analyze` (experimental)
analyzer_rules:
- explicit_self
# настройка правил
cyclomatic_complexity:
ignores_case_statements: true
trailing_closure:
only_single_muted_parameter: true
missing_docs:
warning:
- public
- open
trailing_semicolon: error
empty_count:
only_after_dot: true
closing_brace: error
opening_brace:
severity: error
statement_position:
severity: error
colon:
severity: error
return_arrow_whitespace: error
comma: error
vertical_parameter_alignment: error
vertical_parameter_alignment_on_call: error
anyobject_protocol: error
private_outlet:
allow_private_set: true
lower_acl_than_parent: error
operator_usage_whitespace:
severity: error
skip_aligned_constants: false
collection_alignment:
severity: error
redundant_type_annotation: error
multiline_arguments:
severity: error
first_argument_location: next_line
only_enforce_after_first_closure_on_first_line: true
multiline_arguments_brackets: error
multiline_parameters_brackets: error
multiline_literal_brackets: error
multiline_function_chains: error
modifier_order:
preferred_modifier_order: [acl, setterACL, override, dynamic, mutators, lazy, final, required, convenience, typeMethods, owned]
# кастомные правила
custom_rules:
rus_characters:
name: "Russian characters"
regex: '([А-я]+)'
match_kinds:
- identifier
- parameter
message: "Do not use russian characters in identifiers or parameters"
severity: error
print_using:
name: "Print using"
regex: '^\s*print\(.*\)'
message: "Print decrease performance of the app"
severity: warning
image_name_initialization:
name: "Image initialization without SwiftGen"
regex: 'UIImage\(named:[^)]+\)'
message: "Use SwiftGen UIImageView(image: Asset.someImage.image)"
severity: warning
image_literal_initialization:
name: "Image Literal initialization without SwiftGen"
regex: '#imageLiteral\(resourceName:[^)]+\)'
message: "Use SwiftGen UIImageView(image: Asset.someImage.image)"
severity: warning
color_literal_using:
name: "colorLiteral using"
regex: '#colorLiteral\(.*\)'
message: "Use SwiftGen ColorName.someColor.color"
severity: warning
numbers_smell:
name: "Numbers smell"
regex: '(case|return)\s-?\d{1,}'
message: "Numbers smell. Define a constant instead."
severity: warning
# максимально допустимая длина строки
line_length: 120
# настройка содержимого типа
type_body_length:
warning: 400
error: 600
# настройка содержимого файла
file_length:
warning: 500
error: 1200
ignore_comment_only_lines: true
# настройка названия типа
type_name:
min_length: 3 # only warning
max_length: # warning and error
warning: 40
error: 50
excluded: iPhone # excluded via string
allowed_symbols: ["_"] # these are allowed in type names
# настройка названия переменной
identifier_name:
min_length: # only min_length
error: 2 # only error
excluded: # excluded via string array
- x
- y
- z
- id
# настройка уровня вложения
nesting:
type_level: 4
# максимально допустимое кол-во предупреждений
warning_threshold: 120
# тип отчёта по правилам, варианты: (xcode, json, csv, checkstyle, junit, html, emoji, sonarqube, markdown)
reporter: "xcode"